Skip to content

Instantly share code, notes, and snippets.

View aarongodin's full-sized avatar
🏃‍♂️
encours

Aaron Godin aarongodin

🏃‍♂️
encours
View GitHub Profile
@aarongodin
aarongodin / parallel.html
Last active May 19, 2016 22:09
Parallel AJAX with Rx.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Parallel AJAX</title>
<style>
body {
font-family: Arial;
@aarongodin
aarongodin / .vimrc
Last active February 23, 2016 16:14
" iMproved!
set nocompatible
" Vundle initialization
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Vundle
Plugin 'VundleVim/Vundle.vim'
function tma() {
tmux attach -t $1
}
function tml() {
tmux list-sessions
}
function tmn() {
tmux new -s $1
function rm-swap {
# Recursively remove vim swap files
find . -name "*.swp" -print0 | xargs -0 rm -rf
}
function queryString (object) {
return Object.keys(object)
.reduce(function (collect, key, index, keys) {
collect.push(key + '=' + encodeURIComponent(object[key]))
return collect
}, [])
.join('&')
}
// Usage
@aarongodin
aarongodin / example1.js
Created February 16, 2017 22:14
React IoC Examples
import React from 'react';
const EmailValidator = {
validate: (input) => {
return input.match && input.match(/\S+@\S+(\.\S{2,3})+/);
},
createErrorMessage: () => {
return 'Input was not a valid email';
}
require "json"
def boop(props : JSON::Type)
puts props
end
boop({ "test" => "test" }) # => {"test" => "test"}
# This has a compile error
#
@aarongodin
aarongodin / boop.sh
Created February 26, 2018 16:51
Make iTerm2 resize correctly with spectacle
defaults write com.googlecode.iterm2 DisableWindowSizeSnap -integer 1
num = 50
str1 = %(my num is #{num})
str1 = %[my num is #{num}]
str1 = %{my num is #{num}}
str1 = %<my num is #{num}>
str1 = %|my num is #{num}|
@aarongodin
aarongodin / nested_object.ts
Created July 26, 2022 20:13
Recursive partial object matching with Jest expectations
import expect from "expect"
import lodash from "lodash"
function objectToNestedExpectations(input: any) {
const target = {} as any
for (const [key, value] of Object.entries(input)) {
if (lodash.isPlainObject(value)) {
target[key] = objectToNestedExpectations(value)
} else {