Skip to content

Instantly share code, notes, and snippets.

View MatthewCallis's full-sized avatar
🍖
Hungry Goriya

Matthew Callis MatthewCallis

🍖
Hungry Goriya
View GitHub Profile
@denizozger
denizozger / fxn.js
Created December 13, 2016 18:09
Ramda cheatsheet
// 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]';
}
@eguven
eguven / brew-list.sh
Last active June 1, 2024 04:12
List all packages installed using Homebrew and their sizes
# 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,
@andrewmclagan
andrewmclagan / CreateUser.js
Last active May 7, 2020 11:51
[6.x.x] ReduxForm testing
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 => {
@alirobe
alirobe / reclaimWindows10.ps1
Last active June 7, 2024 16:24
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### 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
###
###
@Avaq
Avaq / combinators.js
Last active June 7, 2024 20:31
Common combinators in JavaScript
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))
@jsdf
jsdf / __tests__getStuff-test.js
Last active August 30, 2020 20:02
Writing and testing async JS with Jest, promises and async functions
jest.dontMock('../getStuff');
describe('getStuff', () => {
let getStuff;
let request;
let stuffStore;
it('loads the data', () => {
const id = 1;
const data = {a: 1};