Skip to content

Instantly share code, notes, and snippets.

View rmehner's full-sized avatar
🤷‍♀️
¯\_(ツ)_/¯

Robin Mehner rmehner

🤷‍♀️
¯\_(ツ)_/¯
View GitHub Profile
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@philippbosch
philippbosch / README.md
Created July 26, 2011 18:53
Small bash script to fetch the latest version of some JS libraries from the net and store it locally

latest

latest is a small bash script that fetches the latest version of a JavaScript library from the net and stores it in a local file.

Installation

Copy latest to a directory in your path, e.g. /usr/local/bin or ~/bin.

Usage

@pat
pat / gist:1096339
Created July 21, 2011 01:43
Check definition pair in a definition list
Then /^"([^"]*)" should be set as "([^"]*)"$/ do |term, definition|
first(:xpath, "//dd[preceding-sibling::dt[.='#{term}']]").text.
should == definition
end
@ded
ded / parallel.js
Created July 21, 2011 01:10
call multiple async methods in parallel and receive the result in a callback
function parallel() {
var args = Array.apply(null, arguments)
, callback = args.pop()
, returns = []
, len = 0
args.forEach(function (el, i) {
el(function () {
var a = Array.apply(null, arguments)
, e = a.shift()
if (e) return callback(e)
@apalmblad
apalmblad / fast-require-ruby-19.2-p180
Created May 30, 2011 20:46
fast require, ruby 1.9.2-180
diff --git a/array.c b/array.c
index b1616c5..16326fc 100644
--- a/array.c
+++ b/array.c
@@ -302,7 +302,7 @@ ary_alloc(VALUE klass)
return (VALUE)ary;
}
-static VALUE
+VALUE
<!-- in response to http://twitter.com/cramforce/status/57406808142266369 -->
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
function getFollowers( name, cb ) {
var obj = {}
jQuery.getJSON(
"https://api.twitter.com/1/followers/ids.json?screen_name=" + name + "&callback=?", cb
if defined?(RSpec)
namespace :rcov do
RSpec::Core::RakeTask.new(:rspec_aggregate) do |task|
task.pattern = 'spec/**/*_spec.rb'
task.rspec_opts = "--format progress"
task.rcov = true
task.rcov_opts = "--rails --exclude osx\/objc,spec,gems\/ " +
"--aggregate tmp/coverage.data"
end
@theophani
theophani / Placeholder workaround
Created January 10, 2011 10:43
shows and hides a label, used as placeholder text
// Relevant HTML and JS
<label for="searchbox" id="searchboxPlaceholder">Search</label>
<input type="text" name="Query" id="searchbox" />
<script>
(function(d){
var sb = d.getElementById('searchbox'),
ph = d.getElementById('searchboxPlaceholder');
var hide = function() {
ph.style.display = 'none';
@sstephenson
sstephenson / gist:771090
Created January 8, 2011 19:41
Automatic *.test host resolution in OS X
$ sudo su -
# mkdir /etc/resolver
# cat > /etc/resolver/test
nameserver 127.0.0.1
port 2155
^D
^D
$ brew install dnsmasq
$ dnsmasq --port=2155 --no-resolv --address=/.test/127.0.0.1
$ ping foo.test
@cowboy
cowboy / qunit-async-bad.js
Created January 3, 2011 23:18
QUnit: multiple async tests in one test
// Don't do this! Why? It will wait for two seconds, regardless.
asyncTest( "multiple async w/ setTimeout", function() {
expect( 4 );
var url = "http://jsfiddle.net/echo/jsonp/?callback=?";
$.getJSON( url, { a: 1 }, function( data ) {
ok( data, "data is returned from the server" );
equal( data.a, "1", "the value of data.a should be 1" );