Skip to content

Instantly share code, notes, and snippets.

View evanrs's full-sized avatar
🏋️‍♂️
Focusing

Evan Schneider evanrs

🏋️‍♂️
Focusing
View GitHub Profile
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active March 17, 2025 08:19
React Native Bridging Cheatsheet
@staltz
staltz / comment.md
Created March 15, 2017 15:27
Nested Pick<T, K> in TypeScript 2.2

TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

@vlucas
vlucas / encryption.ts
Last active March 24, 2025 13:09
Stronger Encryption and Decryption in Node.js
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters)
const IV_LENGTH: number = 16; // For AES, this is always 16
/**
* Will generate valid encryption keys for use
* Not used in the code below, but generate one and store it in ENV for your own purposes
*/
export function keyGen() {
@voodooattack
voodooattack / combine-graphql.js
Last active February 6, 2022 15:11
Combine two GraphQL schemas
import { parse, visit, print } = from 'graphql/language';
/**
* Combine the fields of two or more AST nodes, does no error checking!
* @param types An array with types to combine.
* @returns {*}
*/
export function combineASTTypes(types) {
return types.reduce((p, n) => Object.assign(p, n, { fields: n.fields.concat(p.fields || []) }), {});
}
@evanrs
evanrs / flatMapObject.js
Last active June 7, 2017 04:22
Functions
import flatMap from 'lodash/flatMap';
import keys from 'lodash/keys';
import get from 'lodash/get';
import identity from 'lodash/identity';
import isArray from 'lodash/isArray';
import isDate from 'lodash/isDate';
import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';
import map from 'lodash/map';
import zipObject from 'lodash/zipObject';
@bsingr
bsingr / LICENSE.txt
Last active December 6, 2024 16:54
http json echo server written in python3
Copyright (c) 2016 Jens Bissinger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@kloudsamurai
kloudsamurai / java_homebrew.sh
Last active September 10, 2021 13:53
Install Java via Homebrew (brew) on Mac OSX with unlimited strength JCE
brew update
brew cask install java
brew cask install jce-unlimited-strength-policy
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
@keijiro
keijiro / ffmpeg.bat
Created October 9, 2016 05:51
ffmpeg cheatsheet
:: Trim from 2″ for 3 seconds, and encode into a "Twitter friendly" format.
ffmpeg -i source.mp4 -pix_fmt yuv420p -an -ss 2 -t 3 temp.mp4
:: Make a palette for GIF.
ffmpeg -i temp.mp4 -vf palettegen=max_colors=24 palette.png
:: Make a GIF with the palette.
ffmpeg -i temp.mp4 -i palette.png -filter_complex "scale=400:-1:flags=lanczos[x];[x][1:v]paletteuse" -r 30 out.gif
@oldwestaction
oldwestaction / tabbycatswag.json
Last active November 11, 2023 01:52
hack for the tabby cat chrome extension to unlock all the accessories
{"collected":["glasses-1","glasses-2","glasses-3","glasses-4","hat-1","hat-2","hat-3","hat-4","hat-5","hat-6","hat-7","hat-8","toy-1","toy-2","toy-3","toy-4","toy-5","toy-6","toy-7","toy-8"],"active":{"hat":"hat-8","toy":"toy-3","glasses":"glasses-3"},"unseen":[],"shuffle":false}
@jasongilman
jasongilman / atom_clojure_setup.md
Last active May 11, 2024 02:25
This describes how I setup Atom for Clojure Development.

Atom Clojure Setup

This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.

Install Atom

Download Atom

The Atom documentation is excellent. It's highly worth reading the flight manual.