This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace | |
so it's better encapsulated. Now you can have multiple random number generators | |
and they won't stomp all over eachother's state. | |
If you want to use this as a substitute for Math.random(), use the random() | |
method like so: | |
var m = new MersenneTwister(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/927358/git-undo-last-commit | |
Undo a commit and redo | |
$ git commit ... | |
$ git reset --soft HEAD^ (1) | |
$ edit (2) | |
$ git commit -a -c ORIG_HEAD (3) | |
This is most often done when you remembered what you just committed is incomplete, or you misspelled your commit message, or both. Leaves working tree as it was before "reset". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import re | |
from lettuce import world, step, before | |
from lettuce_webdriver.util import find_field | |
from lettuce_webdriver import webdriver # We need this to register "I visit..." | |
from nose.tools import assert_true | |
from selenium import webdriver | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile | |
@before.all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
Usage: | |
* add model.name property that will be used as a namespace in the json request | |
* put this code before your Backbone app code | |
* use toJSON() as usual (so there is no namespacing in your templates) | |
* your model's data will be sent under model.name key when calling save() | |
### | |
# save reference to Backbone.sync | |
Backbone.oldSync = Backbone.sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install instructions for 10.2: | |
http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b15666/toc.htm | |
http://download.oracle.com/docs/cd/B19306_01/install.102/b15667/toc.htm | |
[Required files] | |
10201_database_linux_x86_64.cpio.gz | |
10201_companion_linux_x86_64.cpio.gz | |
p6810189_10204_Linux-x86-64.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<p>These should output "last", "ok", then "all" for 10 promises and then another 10.</p> | |
<div id="out"></div> | |
<script type="text/javascript" src="https://raw.github.com/briancavalier/when.js/dev/when.js"></script> | |
<script type="text/javascript" src="main.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NODE_VERSION=0.4.7 | |
NPM_VERSION=1.0.94 | |
# Save script's current directory | |
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
#cd "${DIR}" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace any brackets with real values | |
# Try to ssh in to DREAMHOST (ensure it no longer asks for a PW); you may want to restart Terminal | |
ssh [user]@[host] | |
cd ~ | |
mkdir [mydomain_com].git | |
cd [mydomain_com].git | |
git init --bare | |
vi hooks/post-receive | |
# Enter the code from the "post-receive" file (in this gist); save + quit |
OlderNewer