Skip to content

Instantly share code, notes, and snippets.

Michael Hayman michaelhayman

  • Toronto, ON
Block or report user

Report or block michaelhayman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@michaelhayman
michaelhayman / flatten-integers.js
Last active Feb 7, 2019
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers
View flatten-integers.js
// flatten an array of arbitrarily nested arrays of integers
// into a flat array of integers.
// e.g. [[1,2,[3]],4] -> [1,2,3,4]
//
// could be extended to check for objects, etc. but spec says to only
// expect integers.
const flattenIntegers = (array, flattenedArray = []) => {
array.forEach(element => {
if (Array.isArray(element)) {
@michaelhayman
michaelhayman / gist:fde975809c274df6e169
Created Jan 14, 2016
Recursive search and replace
View gist:fde975809c274df6e169
find . -type f -name '*.rb' -exec sed -i '' s/flash/flash.now/ {} +
@michaelhayman
michaelhayman / gist:1d95d0b99bd9c887cace
Created Sep 22, 2014
Add local domains to Genymotion
View gist:1d95d0b99bd9c887cace
Find adb (e.g. /Applications/android/sdk/platform-tools)
adb root
adb remount
adb push /etc/hosts /system/etc
Now you should be able to use local domain aliases in the simulator.
View gist:93a90e8e06b6a20217a6

Find all files under current directory & open them in split vim windows:

find . -name '*.rb' -exec vim -O {} +

View .gitignore
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
You can’t perform that action at this time.