Skip to content

Instantly share code, notes, and snippets.

View boennemann's full-sized avatar

Stephan Bönnemann-Walenta boennemann

View GitHub Profile

When a beginner asks you "when do I use semi-colons?" would you rather say this?

// what people who say "use semicolons!!" say
class Foo {
  prop = {
  }; // yes
@mikeal
mikeal / gist:6685843
Last active December 23, 2015 19:58
Response to comments by Issac Roth of StrongLoop

This is rather out of date and we've all moved past it. Me and Issac are cool now.

pic

# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'
@sindresorhus
sindresorhus / more-mute-regex.md
Created October 18, 2012 08:14 — forked from jimmynotjim/more-mute-regex.md
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

##Simply annoying Tweets

Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD

([a-z])/1{4}

Tweet w/ just a single hashtag: #omgthissucks

^ *#[^ ]+$
@cowboy
cowboy / grunt-subgrunt.js
Created October 2, 2012 13:31
Grunt 0.4.0a (devel) Run a subproject's grunt tasks.
/*
* grunt-subgrunt
* http://gruntjs.com/
*
* Copyright (c) 2012 "Cowboy" Ben Alman
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
*/
'use strict';
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

width = 102 # width of rectangle
height = 40 # height of rectangle
pos_x = 3 # x coordinate for entire grid
pos_y = 3 # y coordinate for entire grid
y_margin = 3 # vertical space between rectangles
x_margin = 3 # horizontal space between rectangles
columns = 3 # number of columns
rows = 5 # number of rows
columns.times do |col| # number of columns
@simX
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
@rexmac
rexmac / gist:3189232
Created July 27, 2012 17:21 — forked from getify/gist:3185473
attempting to use jParser to extract dimensions of JPG image file
var fs = require("fs");
var jParser = require("jParser");
var eof = false;
fs.readFile("sample.jpg",function(err,data) {
if (!err) {
var view = new jDataView(data, undefined, undefined, false);
var parser = new jParser(view,{
// JPG
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"