Skip to content

Instantly share code, notes, and snippets.

@christian-bromann
christian-bromann / webdriverjs.with.jasmine.spec.js
Created September 2, 2013 20:13
run WebdriverJS with Jasmine
var webdriverjs = require('webdriverjs');
describe('my webdriverjs tests', function() {
var client = {};
jasmine.DEFAULT_TIMEOUT_INTERVAL = 9999999;
beforeEach(function() {
client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} });
client.init();
@machty
machty / new-router-examples.md
Last active April 16, 2020 22:03
How to do cool stuff with the new Router API
@getify
getify / ex1-prototype-style.js
Last active January 7, 2024 11:58
OLOO (objects linked to other objects) pattern explored (with comparison to the prototype style of the same code)
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,"Bar:" + who);
@dmitriz
dmitriz / backbone-app-tutorial.html
Last active August 29, 2016 14:48
Backbone App: Beginner Tutorial
<!--
Web Application with Backbone: BEGINNER TUTORIAL
Backbone.js is a very popular and light(weight) JavaScript library
for building Web Applications.
However, learning it I found frustratingly few simple examples of
true workable applications with all lines of code explained.
Here is my attempt to hack the popular Jerome Gravel-Niquet's Backbone Todo App
@novoj
novoj / MonteCarlo.java
Created December 10, 2012 09:13
Monte Carlo test for testing different strategies for guessing game. You have three doors and only one is winning one. You make your choice, and then moderator opens some other door showing you that this doors don't win. He then offers you to change your guess. Will you have bigger chance to win when you change your mind or not?
import java.util.Random;
public class MonteCarlo {
private enum Choice {
WINNING, LOSING
}
private static int ITERATIONS = 1000000;
private static final Random randomGenerator = new Random();
private static GuessStrategy stayStrategy = new StayStrategy();
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@millermedeiros
millermedeiros / .vimrc
Last active December 11, 2023 14:44
My VIM settings (.vimrc)
" =============================================================================
" Miller Medeiros .vimrc file
" -----------------------------------------------------------------------------
" heavily inspired by: @factorylabs, @scrooloose, @nvie, @gf3, @bit-theory, ...
" =============================================================================
" -----------------------------------------------------------------------------
" BEHAVIOR
@dtrce
dtrce / mp3.js
Created September 8, 2011 18:39
streaming mp3 using nodejs
var http = require('http'),
fileSystem = require('fs'),
path = require('path')
util = require('util');
http.createServer(function(request, response) {
var filePath = 'path_to_file.mp3';
var stat = fileSystem.statSync(filePath);
response.writeHead(200, {