Skip to content

Instantly share code, notes, and snippets.

View nmccready's full-sized avatar

nmccready nmccready

View GitHub Profile
@nmccready
nmccready / arguments.sh
Created April 23, 2019 20:16
argument collector
#!/bin/sh
set -e
set -o pipefail
# collect arguments to forward on
while [[ "$#" > 0 ]]; do case $1 in
# example to save value
# -v|--data-volume) shift; dataVolume=$1;; # --data-volume someval
*) args[${#args[@]}]=$1;;
esac; shift; done
MY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$MY_DIR"
cd ../ # normalize to a known working directory could be ../../
@zenkay
zenkay / gist:3237860
Created August 2, 2012 15:19
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

@mislav
mislav / poor_promise.js
Last active May 21, 2021 21:52
Poor man's Promise is a minimal but complete implementation of Promises/A+ spec.
(function(self){
if (self.Promise) return
// Implements https://promisesaplus.com
function isFunction(fn) {
return typeof fn == 'function'
}
// Values that should never be checked for presence of a `then` method
function simpleValue(fn) {
function isUser (auth, userKey) {
return auth.uid == userKey;
}
function isAdmin (auth) {
return root.child('users').child(auth.uid).child('isAdmin').val() == true;
}
path /users/{uid} {
read() { isUser(auth, uid) || isAdmin(auth) }
@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@bsodmike
bsodmike / solutions.md
Last active June 3, 2022 08:33
Solutions to Lessons @ RegexOne.com
@sadache
sadache / gist:4714280
Last active July 14, 2022 15:09
Playframework: Async, Reactive, Threads, Futures, ExecutionContexts

Asynchronicity is the price to pay, you better know what you're paying for...

Let's share some vocabulary first:

Thread: The primitive responsible of executing code on the processor, you can give an existing (or a new) Thread some code, and it will execute it. Normally you can have a few hundreds on a JVM, arguments that you can tweak your way out to thousands. Worth noting that multitasking is achieved when using multiple Threads. Multiple Threads can exist for a single processor in which case multitasking happens when this processor switches between threads, called context switching, which will give the impression of things happenning in parallel. An example of a direct, and probably naive, use of a new Thread in Java:

public class MyRunnable implements Runnable {
  public void run(){
 System.out.println("MyRunnable running");
@remy
remy / dev.js
Created October 9, 2016 16:29
A webpack config with dynamic loader to be used with React
// filename: lib/dev.js
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const webpack = require('webpack');
// expects to live in ./lib
const config = Object.assign({}, require('../webpack.config.dev'), {
// customisations that were typically off, but I could turn on during experiments
});
@stephenparish
stephenparish / submodule-pull.sh
Created July 15, 2014 15:03
Update submodules in a git repository to the latest, but exclude one..
git submodule foreach '[ "$path" == "submodule-to-exclude" ] || git pull origin master'