Skip to content

Instantly share code, notes, and snippets.

Avatar

Raine Revere raineorshine

View GitHub Profile
@raineorshine
raineorshine / or.js
Created Nov 11, 2020
Functional programming "or" in Javascript
View or.js
/*
An "or" function is a higher-order function that composes multiple predicates into one,
such that the composed predicate will return true if at least one of the predicates
returns true for the given argument. (A predicate is a function that returns `boolean`.)
e.g.
const isEven = n => n%2 === 0
const isPositive = n => n > 0
// un-fancy
View KeyboardControlConfig.txt
{
"drawhint": [
[{
"char": "l"
}]
],
"drawhintn": [
[{
"shift": true,
"char": "l"
@raineorshine
raineorshine / togif.sh
Created Jul 12, 2020
Convert a video to an animated gif (with small file size!)
View togif.sh
# convert a video to an animated gif
# requires ffmpeg and gifsicle
togif() {
if [ $# -lt 1 ]
then
echo "Converts a video to a compressed, animated gif. Outputs to INPUT.xyz.gif"
echo ""
echo "Usage:"
echo "togif input.mov"
return 1
View em-proto-recentlyEdited-export 06-05-20 scrubbed.json
{
"10391939175ab928c729511332ec9883" : {
"9a40cbd4ba0ba21269bcb0228eb1f6f6" : {
"c427925417b73918db2732368c79bc48" : {
"550179f314032c3690136920213af67a" : {
"lastUpdated" : "2020-06-05T00:56:55.025Z",
"leaf" : true,
"path" : [ {
"rank" : 4.0419921875,
"value" : "🏡 Home"
@raineorshine
raineorshine / multiple-return-vs-ternary.md
Created May 23, 2020
Why multiple return statements should be avoided
View multiple-return-vs-ternary.md

Note the following code:

if (a) {
  foo()
  bar()
}
else {
  foo()
  moo()
@raineorshine
raineorshine / refined-github.css
Last active Nov 22, 2020
Custom CSS for my Refined GitHub
View refined-github.css
/* https://github.com/sindresorhus/refined-github */
/* conflict marker positioning */
.rgh-conflict-marker { margin-left: 5px !important; margin-right: 0 !important }
/* everhour start icon */
.js-issue-row .everhour.start { display: none !important; }
/* reset row size */
.js-issue-row .text-small.text-gray { line-height: inherit; !important }
@raineorshine
raineorshine / alias_completion.sh
Last active Mar 22, 2020 — forked from kopischke/alias_completion.sh
Automatically add completion functions for aliases
View alias_completion.sh
# https://superuser.com/questions/436314/how-can-i-get-bash-to-perform-tab-completion-for-my-aliases/437508#437508
# Usage:
# 1. Save alias_completion.sh to /usr/local/etc/ or wherever.
# 2. echo "source /usr/local/etc/alias_completion.sh" >> ~/.bash_profile
# 3. source ~/.bash_profile
# Automatically add completion for all aliases to commands having completion functions
function alias_completion {
local namespace="alias_completion"
@raineorshine
raineorshine / test.txt
Created Oct 4, 2019
Test gist linkability
View test.txt
This is a sample sentence.
That is a tample tentence.
View testrpc.sh
npm rebuild leveldown scrypt;
echo "Starting Testrpc..."
./node_modules/ethereumjs-testrpc/bin/testrpc --port 8545 --account "0xb21e287e6dcb34cf16abb6ce71f7209906c13f763c6415c6b2320eea7688212f, 10000000000000000000000000" --account "0x3ba8150286625233d3154d795527e3cbbc07a135d14392e9485f08d2d555fb3d, 10000000000000000000000000" &
testrpc_pid=$!
sleep 5;
karma start config.karma.js
echo "Shutting down TestRpc..."
kill -9 $testrpc_pid
./node_modules/.bin/electron-rebuild;
View ncu-444-output.sh
> npm-check-updates@2.14.2 test /Users/raine/projects/npm-check-updates
> npm run lint ; mocha && mocha test/individual
> npm-check-updates@2.14.2 lint /Users/raine/projects/npm-check-updates
> eslint bin lib test
npm-check-updates
You can’t perform that action at this time.