This file contains 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
// Make new flatDict and return it | |
function flattenDictionary(dict) { | |
const go = (dict, initialKey, flatDict) => { | |
for (const key of Object.keys(dict)) { | |
const value = dict[key]; | |
const flatKey = initialKey ? `${initialKey}.${key}` : key; | |
// When the value is a primitive | |
if (typeof value !== 'object') flatDict[flatKey] = value; |
This file contains 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 Nightmare from 'nightmare'; | |
import colors from 'chalk'; | |
import fs from 'fs'; | |
import path from 'path'; | |
import config from './../config.js'; | |
/* ------------------------------------------ *\ |
This file contains 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
// ------------------------------------------------- \\ | |
// Check Mobile version | |
// ------------------------------------------------- // | |
const USER_AGENT = navigator.userAgent || navigator.vendor || window.opera | |
/** | |
* Detect if the enviroment executing this script is a Windows phone | |
* @returns {boolean} | |
*/ |
This file contains 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
/** | |
* Check if device has a touch screen | |
* | |
* @returns {boolean} | |
*/ | |
function isTouchDevice() { | |
return !!(window.ontouchstart && navigator.maxTouchPoints > 0) | |
} |
This file contains 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
/** | |
* Wrapper for `addEventListener` | |
* | |
* @param {HTMLElement} target | |
* @param {string} eventType | |
* @param {function} eventHandler | |
* @param {boolean|Object.<boolean>} opt - useCapture OR | |
* {capture, once, passive} (NOTE: Low browser support) | |
*/ | |
function on(target, eventType, eventHandler, opt = false) { |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
* { | |
box-sizing: inherit; | |
} |
This file contains 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 ShallowRenderer from 'react-test-renderer/shallow' | |
import expect from 'expect' | |
import expectJSX from 'expect-jsx' | |
expect.extend(expectJSX) | |
// Component | |
const Greeting = ({greeting}) => ( |
This file contains 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
/** | |
* Undefined cannot be assigned using window.undefined = someVal or | |
* undefined = someVal but can be changed using function scope. | |
* window.undefined is the same as window['undefined'] | |
* | |
* The same example does not work with the null keyword and program throws | |
* a syntax error (function (null) {...})(123) | |
*/ | |
;(function (undefined) { | |
// x is undefined |
This file contains 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 { createStore } from './lib' | |
/** | |
* Main reducer | |
*/ | |
const counter = function (state = 0, action) { | |
switch (action.type) { | |
case 'INCREMENT': | |
return state + 1 |
This file contains 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
/** | |
* PATH: -> ./src/redux/modules/widgets.js | |
* | |
* [RULES] | |
* | |
* A module... | |
* | |
* - MUST export default a function called reducer() | |
* - MUST export its action creators as functions | |
* - MUST have action types in the form npm-module-or-app/reducer/ACTION_TYPE |
OlderNewer