Skip to content

Instantly share code, notes, and snippets.

View MaxPleaner's full-sized avatar

Max Pleaner MaxPleaner

View GitHub Profile
@MaxPleaner
MaxPleaner / object.prototype.js
Created July 19, 2017 19:50 — forked from mattbaker/object.prototype.js
Object.tap in Javascript
Object.prototype.tap = function(f){f.apply(this); return this;}
var x = {a:2};
x.tap(function(){console.log(this.a)}).a = 4; //Prints 2
console.assert(x.a == 4);
@MaxPleaner
MaxPleaner / times.coffee
Last active January 27, 2017 15:57 — forked from FGRibreau/times.js
Ruby .times & .upto & .downto methods in Coffeescript
# Ruby = 5.times { |i| puts i }
# Coffee = (1).times (i) -> console.log i
Number.prototype.times = (cb) ->
i = -1;
while (++i < this) then cb(i)
+this
# Ruby = 1.upto(5) { |i| puts i }
# Coffee = (1).upto 5, (i) -> console.log i
Number.prototype.upto = (t, cb) ->
@MaxPleaner
MaxPleaner / node-and-npm-in-30-seconds.sh
Created August 6, 2016 20:43 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@MaxPleaner
MaxPleaner / 16step.coffee
Created December 14, 2015 18:36 — forked from peterc/16step.coffee
Simple 16 step drum machine using CoffeeScript and Node
# Simple 16 step drum machine experiment with Node and CoffeeScript
# by Peter Cooper - @peterc
#
# Inspired by Giles Bowkett's screencast at
# http://gilesbowkett.blogspot.com/2012/02/making-music-with-javascript-is-easy.html
#
# Screencast demo of this code at http://www.youtube.com/watch?v=qWKkEaKL6DQ
#
# Required:
# node, npm and coffee-script installed
@MaxPleaner
MaxPleaner / gist:2d586e398600fa624d51
Created November 8, 2015 22:23 — forked from trcarden/gist:3295935
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@MaxPleaner
MaxPleaner / 0_reuse_code.js
Created February 10, 2014 00:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console