var state = {
id: 1,
points: 100,
name: "Goran"
};
var newState = {
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
'use strict'; | |
class Frame { | |
constructor(samples){ | |
// A single frame == 1 second of audio with a 44100 sample rate | |
this.prev = null; | |
this._next = null; | |
// this.samples = samples || new Float32Array(44100); | |
this.samples = samples || []; | |
this.callbacks = []; |
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
// from and to are objects that live somewhere else (for examples sake) | |
uiGmapGoogleMapApi.then(function(maps){ | |
var directionsService = new maps.DirectionsService(); | |
var request = { | |
origin: new maps.LatLng( | |
from.lat(), | |
from.lng() | |
), |
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, { Component } from 'react'; | |
export const withReducer = ( | |
stateName = 'internalState', | |
dispatchName = 'internalDispatch', | |
reducer = (state) => state, |
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, { Component } from 'react'; | |
export const withLifecycle = (hooks) => (BaseComponent) => { | |
return class WithLifecycle extends Component { | |
componentWillMount() { | |
hooks.willMount && hooks.willMount(this.props); | |
} |
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
const compose = (...funcs) => (value) => funcs.reduce((v, fn) => fn(v), value); | |
const typeValueAction = (type) => (value) => ({ type, 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
# OSX for Hackers (Mavericks/Yosemite) | |
# | |
# Source: https://gist.github.com/brandonb927/3195465 | |
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront |
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
#!/bin/bash | |
# find the changed files, get the name only and pipe result to a while loop | |
git diff --cached --name-only | while read FILE; do | |
# ff file matches extension pattern then | |
if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then | |
# if file is actually and file that exists then | |
if [[ -f $FILE ]]; then | |
# php lint the file and | |
php -l "$FILE" 1> /dev/null |
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
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; |