Skip to content

Instantly share code, notes, and snippets.

View cognitivim's full-sized avatar

Marina Karpukhina cognitivim

View GitHub Profile
import { ComponentType } from 'react';
/**
* function that performs no operations
*/
const noop = Object.freeze(() => {
/**/
});
const arrayToMap = (list: any) => list.reduce(
import logger from 'winston';
function gracefulHadleExit(onExit) {
let shutdownInProgress = false;
async function exit(exitCode = 0, err = null) {
if (shutdownInProgress) return;
automatic update by http://atom.io/packages/sync-settings
@cognitivim
cognitivim / wiki-to-md.cmd
Created August 21, 2017 16:31
Convert mediawiki to markdown with pandoc
pandoc -w markdown_github in.wiki -o out.md
@cognitivim
cognitivim / promisify.js
Created August 17, 2017 19:02
It converts a callback-based function to a Promise-based one.
function promisify(func) {
return (...args) => new Promise((resolve, reject) => {
func(...args, (err, ...results) => {
if (err) return reject(err);
resolve(results.length === 1 ? results[0] : results);
});
@cognitivim
cognitivim / create-react-native.cmd
Last active June 17, 2017 19:37
react-native-haul
cd /d %~dp0
set PROJECT_NAME = NewProject
mkdir %PROJECT_NAME% && cd %PROJECT_NAME%
yarn init --yes
yarn add react-native-cli --dev
cd .. && "./%PROJECT_NAME%/node_modules/.bin/react-native" init %PROJECT_NAME%
@cognitivim
cognitivim / android-start.cmd
Last active June 13, 2017 00:37
npm react-native:android-start
cd /d %~dp0
start cmd /k emulator @Nexus_5X_API_26
start cmd /k ".\node_modules\.bin\react-native" start
timeout /15
start cmd /k ".\node_modules\.bin\react-native" run-android
@cognitivim
cognitivim / CustomView.java
Created November 12, 2016 23:24
template for custom view
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
public class CustomView extends View {
{
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.js",
"shell":true,
"encoding": "cp1252",
"windows":
{
"cmd": ["taskkill", "/F", "/IM", "node.exe", "&", "C:/nodejs/node.exe", "$file"],
"shell": true