Skip to content

Instantly share code, notes, and snippets.

View dhei's full-sized avatar

Di Hei dhei

  • GitHub Staff
  • Seattle
  • 04:05 (UTC -07:00)
View GitHub Profile

React Native unsupported features:

Known issue of yarn with private npm packages:

@dhei
dhei / es6-guides-and-references.md
Last active January 1, 2018 00:46
ECMAScript 2015 (es6) Guides and References

ES6 Generator try-finally behavior

  1. Generator try-finally prevents termination from return
  2. The return value of the generator function is the value that was queued prior to entering the finally clause.

Example adapted from Exploring ES6: Generators. The following two ways are equivalent.

  • Invoke .return() on generators:
@dhei
dhei / es6-generator.md
Last active December 27, 2017 17:32
es6 generator

Why value from return statement is ignored when iterating through a generator

If you are iterating through an iterator, using a for ... of loop or something like Array.from, the return value is going to be ignored. In other words, the value included in the end-of-iteration object (whose property done is true) is ignored.

function *gen(){
 const val = yield 4;
 return val * 2;
}
@dhei
dhei / setup-private-cocoapods.md
Last active December 25, 2017 23:12
Setup private CocoaPods

TL;DR

First create a private spec repository; then setup local cocoapods installation; then one-liner change to Podfile and done.

Steps

  1. Create a private spec repo at SOURCE_URL

  2. Add your prviate spec repo to your CocoaPods installation:

pod repo add REPO_NAME SOURCE_URL
@dhei
dhei / build.gradle
Last active February 10, 2022 07:50
Use environment variables and local.properties to store Bintray publishing secrets
allprojects {
bintray {
user = bintrayUser
key = bintrayKey
configurations = ['archives']
publish = true
pkg {
repo = bintrayRepo
name = "your-package-name"
@dhei
dhei / react-native.md
Last active November 12, 2017 22:21
React Native android bundle

Android

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

(adapted from this stackoverflow question)

iOS

react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --assets-dest ios
@dhei
dhei / awk-example-for-parsing-parameters.sh
Last active October 1, 2017 04:32
Bash scripting cheatsheet
# How to Parse Parameters in Bash
# usage: ./foobar.sh --parameter1=value1 --parameter2=value2 --parameter3=value3
# foobar.sh script
while [ "$1" != "" ]; do
PARAM=`echo $1 | awk -F= '{print $1}'` # -F tells awk to use "=" (equal sign) as field separator. '{print $1}' takes the first one.
VALUE=`echo $1 | awk -F= '{print $2}'` # -F tells awk to use "=" (equal sign) as field separator. '{print $2}' takes the second one.
case $PARAM in
--parameter1) value1=$VALUE ;;
--parameter2) value2=$VALUE ;;
@dhei
dhei / index.android.js
Last active September 26, 2017 18:16
Sample react native app using mobile center
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React from 'react';
import {
AppRegistry,
Text,