Skip to content

Instantly share code, notes, and snippets.

View NV's full-sized avatar

Nikita Vasilyev NV

View GitHub Profile
# Video: http://rubyhoedown2008.confreaks.com/08-chris-wanstrath-keynote.html
Hi everyone, I'm Chris Wanstrath.
When Jeremy asked me to come talk, I said yes. Hell yes. Immediately. But
then I took a few moments and thought, Wait, why? Why me? What am I supposed
to say that's interesting? Something about Ruby, perhaps. Maybe the
future of it. The future of something, at least. That sounds
keynote-y.
/* Use this to cause a function to fire no more than once every 'ms' milliseconds.
For example, an expensive mousemove handler:
$('body').mouseover(ratelimit(function(ev) {
// ...
}, 250));
*/
function ratelimit(fn, ms) {
var last = (new Date()).getTime();
C++ source:
void call_by_reference(int& x)
{
x = 20;
}
void call_by_pointer(int* x)
{
*x = 20;
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
From e22317131b97d0faa5510b528ef515ccbbbd3e8e Mon Sep 17 00:00:00 2001
From: Jacob Rothstein <github@jacobrothstein.com>
Date: Tue, 13 Jul 2010 13:24:34 -0700
Subject: [PATCH] fix showdown to work in chrome (don't use RegExp.leftContext and RegExp.rightContext globals)
---
scripts/showdown.js | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/scripts/showdown.js b/scripts/showdown.js
// cache from global scope
var _parseInt = this.parseInt;
_speedTest(
[
function(n)
{
var r, g, b, s = '#aabbcc';
var i = n; while(i--)
{
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}
/**
* Console object for BESEN
* @author Dmitry A. Soshnikov <dmitry.soshnikov@gmail.com>
*/
(function initConsole(global) {
// helpers
var getClass = Object.prototype.toString;
var timeMap = {};
var express = require('express'),
app = express.createServer();
app.enable('jsonp callback');
app.get('/jsonp', function(req, res) {
res.send({ foo: 'bar' });
});
@tvandervossen
tvandervossen / .kick
Created October 12, 2010 20:18
Reload browser on save Kicker recipe
process do |files|
execute("osascript -e 'tell application \"WebKit\"
do JavaScript \"window.location.reload()\" in first document
end tell'")
end