Skip to content

Instantly share code, notes, and snippets.

View btg5679's full-sized avatar
🎯
Focusing

bg btg5679

🎯
Focusing
View GitHub Profile
...
const initialState = {}
const enhancers = []
const middleware = [
thunk,
routerMiddleware(history)
]
const composedEnhancers = compose(
function logger({ getState }) {
return (next) => (action) => {
console.log('will dispatch', action)
return returnValue
}
}
const initialState = {}
const enhancers = []
const middleware = [
function logger({ getState }) {
return (next) => (action) => {
console.log('will dispatch', action)
return returnValue
}
}
const initialState = {}
const enhancers = []
const middleware = [
//Explicit vs. Implicit Coercion in JS
let a = 100;
let b = a + ''; //IMPLICIT COERCION
console.log(b) //'100'
let c = String ( a ) //EXPLICIT COERCION
console.log(c) //'100'
import { AppRegistry } from "react-native";
import App from "./components/App";
AppRegistry.registerComponent("App", () => App);
AppRegistry.runApplication("App", {
rootTag: document.getElementById("root")
});
import React, { Component } from "react";
import { Image, Text, View, Button, Picker } from "react-native";
import { styles } from "../utils/styles";
import SomeCustomComponent from "./SomeCustomComponent";
// see https://github.com/necolas/react-native-web
class App extends Component {
_onButtonPress() {
//do some things
@btg5679
btg5679 / simpleIterator.js
Created July 11, 2018 00:52
Simple Iterator
function makeIterator(array) {
var nextIndex = 0;
console.log("nextIndex =>", nextIndex);
return {
next: function() {
return nextIndex < array.length
? { value: array[nextIndex++], done: false }
: { done: true };
}
function* sample() {
yield "simple";
yield "generator";
}
var it = sample();
console.log(it.next()); // {value: 'simple, done: false}
console.log(it.next()); // {value: 'generator, done: false}
console.log(it.next()); // {value: undefined, done: true}
function* favBeer() {
const reply = yield "What is your favorite type of beer?";
console.log(reply);
if (reply !== "ipa") return "No soup for you!";
return "OK, soup.";
}
{
const it = favBeer();
const q = it.next().value; // Iterator asks question
function TaskNode(task) {
this.taskName = task.name;
this.taskUri = task.id
this.nextTask = null;
this.previousTask = null;
}
function WorkflowTaskLinkedList() {
this.head = new TaskNode({name:"head",id:'http://123'});
this.find = find;