Skip to content

Instantly share code, notes, and snippets.

View NV's full-sized avatar

Nikita Vasilyev NV

View GitHub Profile
function fromJS(anObject)
{
var objectsToReferences = new Map();
return fromJS(anObject);
function fromJS(anObject)
{
if (objectsToReferences.has(anObject))
return objectsToReferences.get(anObject);
C++ source:
void call_by_reference(int& x)
{
x = 20;
}
void call_by_pointer(int* x)
{
*x = 20;
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--)
{
/**
* 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' });
});
@visnup
visnup / README.js
Created November 15, 2010 21:36 — forked from igrigorik/webapp.rb
node.js version inspired by igrigorik's any ruby object, as a webapp! 'cause we can too.
#!/usr/bin/env node
var http = require('http')
, webapp = require('webapp');
http.createServer(webapp.bind([])).listen(8000);
// ^^^^^^^^^^^^^^^
// | (x)
// ROFLSCALE DEQUE ---/
@eligrey
eligrey / createStyleSheet.js
Created March 20, 2011 03:24
document.createStyleSheet(rules)
Document.prototype.createStyleSheet = function (rules) {
var stylesheet = this.documentElement.appendChild(
this.createElementNS("http://www.w3.org/1999/xhtml", "style")
).sheet;
stylesheet.insertRule("@media all{" + rules + "}", 0);
return stylesheet;
};
@eligrey
eligrey / JS demo DOM tips.md
Created September 17, 2011 18:54
JS demo DOM tips

JS demo DOM tips

A few tips for shaving some bytes off your JS demos. I will probably add more to this list in the future.

Escaping HTML (saves 60-93B, depending on host document type)

26B:

new Option(html).innerHTML
@chriseppstein
chriseppstein / 0_silent_selector_grid.scss
Created January 4, 2012 22:08
This gist describes a new feature we're experimenting with for Sass 3.2: placeholder selectors. They do not get generated into your output, but they can be used like a class and extended like one.
$gutter: 10px;
$grid-unit: 60px;
%clearfix {
*zoom: 1;
&:after {
content: "\0020";
display: block;
height: 0;
clear: both;