Skip to content

Instantly share code, notes, and snippets.

View AndrewSouthpaw's full-sized avatar

Andrew Smith AndrewSouthpaw

View GitHub Profile
@AndrewSouthpaw
AndrewSouthpaw / .fzf_setup
Created January 14, 2022 20:32
Configures fzf (fuzzy-finder) tool with git operations.
# custom aliases for fzf
# ======================
# open up a visual finder with git branches to switch to them, including fuzzy-finding
# demo: https://i.imgur.com/xR5ILE5.jpg
alias gf='git checkout $(_gb)'
# opens visual fzf finder for git branches to delete them
alias gbd='git bd $(_gb)'
# fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
@AndrewSouthpaw
AndrewSouthpaw / calendarCopy.js
Created October 12, 2021 03:49
Google Apps script to copy personal events and block those times in your work calendar.
// *******************
// This setup will allow you to synchronize personal events from one calendar (the "secondary calendar")
// to another calendar, e.g. work (the "primary calendar"), but obfuscate the details. Then your coworkers
// know when you're busy but don't get to see the personal details.
//
// Follow these steps:
// 1. Go to https://script.google.com/home and click [+ New project]
// 2. Make sure the two calendars you want to sync can be edited by the Google account you're currently under
// (or switch accounts)
@AndrewSouthpaw
AndrewSouthpaw / remoteJs.js
Created March 12, 2021 17:49
Remote JS snippet
console.log('remote JS from GitHub')
$ ERN_LOG_LEVEL=trace ern create-miniapp fooMiniApp
___ _ _ _ _ _ _ _
| __| |___ __| |_ _ _ ___ __| |___ | \| |__ _| |_(_)_ _____
| _|| / -_) _| _| '_/ _ \/ _` / -_) | .` / _` | _| \ V / -_)
|___|_\___\__|\__|_| \___/\__,_\___| |_|\_\__,_|\__|_|\_/\___|
[v0.38.7] [Cauldron: -NONE-]
pwd
pwd
[ Ensuring that Electrode Native module name is valid (Started) ]
export const minimumSwaps = (arr) => {
const shift = Math.min(...arr)
let swaps = 0
const visited = [...Array(arr.length)].map(() => false)
arr.forEach((val, i) => {
if (val - shift === i || visited[i]) return
let loopLength = 0
let x = i
while (!visited[x]) {
visited[x] = true
@AndrewSouthpaw
AndrewSouthpaw / react-native-flow-stub.js
Created May 10, 2018 08:38
Flow libdef stuf for react-native package.
declare var __DEV__: boolean;
declare module 'react-native' {
declare export var View: any;
declare export var Button: any;
declare export var StyleSheet: any;
declare export var Text: any;
declare export var Platform: any;
declare export var TouchableOpacity: any;
declare export var Image: any;
@AndrewSouthpaw
AndrewSouthpaw / webpack.config.js
Created June 26, 2017 16:49
Trying to use explicit vendor chunks.
// foobar.js
import _ from 'lodash'
console.log(_.map([1, 2, 3], x => x + 1))
// webpack.config.js
// ...snip...
entry: {
common: ['lodash'],
'foobar': './foobar.js',
},
@AndrewSouthpaw
AndrewSouthpaw / jquery-turbolinks-compatibility.js
Created December 16, 2016 22:10
jQuery Turbolinks compatibility file in JS
def insert(pair: (Char, Int), xs: List[(Char, Int)]): List[(Char, Int)] = xs match {
case List() => List(pair)
case y :: ys => {
if (pair._1 == y._1) (pair._1, y._2 + 1) :: ys
else if (pair._1 < y._1) pair :: xs
else y :: insert(pair, ys)
}
}
def insert2(x: (Char, Int), xs: List[Leaf]): List[Leaf] = xs match {