- Create or find a gist that you own.
- Clone your gist (replace
<hash>
with your gist's hash):# with ssh git clone git@gist.github.com:<hash>.git mygist # with https
git clone https://gist.github.com/.git mygist
// Replace this: | |
for (const value of myArray) { | |
console.log(value) | |
} | |
// with: | |
forEach(value => console.log(value), myArray) | |
const double = x => x * 2 | |
map(double, [1, 2, 3]) |
import { assocPath, flip, path, init, last, toPairs } from 'ramda'; | |
function isObject(value: any): boolean { | |
return Object.prototype.toString.call(value) === '[object Object]'; | |
} | |
function isFunction(value: any): boolean { | |
return Object.prototype.toString.call(value) === '[object Function]'; | |
} |
# this original one uses values returned from 'brew info' | |
brew list --formula | xargs -n1 -P8 -I {} \ | |
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \ | |
sort -h -r -k2 - | column -t | |
# faster alternative using 'du' | |
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h |
/** | |
* Returns a Comparison of 2 Tasks | |
* @param {string} projectId the Project ID | |
* @param {Array<string>} taskIds a list of Task IDs | |
* @returns {Promise<Object>} | |
*/ | |
const fetchComparison = (projectId, leftTaskId, rightTaskId) => ( | |
new Promise(resolve => ( | |
R.composeP( | |
resolve, |
<hash>
with your gist's hash):
# with ssh
git clone git@gist.github.com:<hash>.git mygist
# with https
git clone https://gist.github.com/.git mygist
import React, { Component, PropTypes } from 'react'; | |
import { reduxForm, Field } from 'redux-form'; | |
export class CreateUser extends Component { | |
static propTypes = { | |
createUser: PropTypes.func.isRequired, | |
initialValues: PropTypes.object, | |
submitting: PropTypes.bool.isRequired, | |
invalid: PropTypes.bool.isRequired, |
const data = [1, 2, 3, 4]; | |
/** | |
an imperitve replicator | |
[1, 2, 3, 4] => [ 1, 2, 2, 3, 3, 3, 4, 4, 4, 4] | |
**/ | |
var replicator = (collection) => { | |
const ret = []; | |
collection.forEach(val => { |
### | |
### | |
### UPDATE: For Win 11, I recommend using this tool in place of this script: | |
### https://christitus.com/windows-tool/ | |
### https://github.com/ChrisTitusTech/winutil | |
### https://www.youtube.com/watch?v=6UQZ5oQg8XA | |
### iwr -useb https://christitus.com/win | iex | |
### | |
### |
const I = x => x | |
const K = x => y => x | |
const A = f => x => f (x) | |
const T = x => f => f (x) | |
const W = f => x => f (x) (x) | |
const C = f => y => x => f (x) (y) | |
const B = f => g => x => f (g (x)) | |
const S = f => g => x => f (x) (g (x)) | |
const S_ = f => g => x => f (g (x)) (x) | |
const S2 = f => g => h => x => f (g (x)) (h (x)) |
jest.dontMock('../getStuff'); | |
describe('getStuff', () => { | |
let getStuff; | |
let request; | |
let stuffStore; | |
it('loads the data', () => { | |
const id = 1; | |
const data = {a: 1}; |