This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function actionTypeBuilder(prefix) { | |
| return { | |
| type: actionType => `${prefix}/${actionType}`, | |
| loading: actionType => `${actionType}/loading`, | |
| ready: actionType => `${actionType}/ready`, | |
| stopped: actionType => `${actionType}/stopped`, | |
| changed: actionType => `${actionType}/changed`, | |
| error: actionType => `${actionType}/error`, | |
| success: actionType => `${actionType}/success` | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function actionTypeBuilder(prefix) { | |
| return { | |
| type: actionType => `${prefix}/${actionType}`, | |
| loading: actionType => `${actionType}/loading`, | |
| ready: actionType => `${actionType}/ready`, | |
| stopped: actionType => `${actionType}/stopped`, | |
| changed: actionType => `${actionType}/changed`, | |
| error: actionType => `${actionType}/error`, | |
| success: actionType => `${actionType}/success` | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // meteor algorithm to check if this is a meteor serving http request or not | |
| function IsAppUrl(req) { | |
| var url = req.url; | |
| if(url === '/favicon.ico' || url === '/robots.txt') { | |
| return false; | |
| } | |
| // NOTE: app.manifest is not a web standard like favicon.ico and | |
| // robots.txt. It is a file name we have chosen to use for HTML5 | |
| // appcache URLs. It is included here to prevent using an appcache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import AsyncComponent from './AsyncComponent' | |
| // call this.getAsyncComponent(path) to get a default export. | |
| // call this.getAsyncComponent(path, specifier) to get a non-default export. | |
| class App extends AsyncComponent { | |
| render() { | |
| let view; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OldHttpRequest = Turbolinks.HttpRequest | |
| class Turbolinks.CachedHttpRequest extends Turbolinks.HttpRequest | |
| constructor: (_, location, referrer) -> | |
| super(this, location, referrer) | |
| requestCompletedWithResponse: (response, redirectedToLocation) -> | |
| @response = response | |
| @redirect = redirectedToLocation | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule JSONMapBuilder do | |
| def to_map(list) when is_list(list) and length(list) > 0 do | |
| case list |> List.first do | |
| {_, _} -> | |
| Enum.reduce(list, %{}, fn(tuple, acc) -> | |
| {key, value} = tuple | |
| Map.put(acc, binary_to_atom(key), to_map(value)) | |
| end) | |
| _ -> | |
| list |