Skip to content

Instantly share code, notes, and snippets.

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

Robin Mehner rmehner

🤷‍♀️
¯\_(ツ)_/¯
View GitHub Profile

Mein Setup

Must have

Semi-optional

  • Tamper (Stopfer, der mit der Espressomaschine kommt ist nahezu nutzlos, muss schwer sein): ~30, z.B.
@janl
janl / gist:552288
Created August 26, 2010 21:24 — forked from mikeal/gist:552181

Using CouchDB with node.js

First, get yourself a CouchDB! You can get a free hosted CouchDB in seconds or download a binary from the Couchio downloads page.

Next, install npm because all awesome node packages are in npm :)

Node has better support for HTTP than any language I've ever worked with and coincidentally CouchDB's interface is solely accessible via HTTP. First, let's just talk to CouchDB using an HTTP library and later we'll look at some higher level abstractions.

Talking to CouchDB using request

@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" );
@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
@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';
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
<!-- 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
@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
@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)
@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