Skip to content

Instantly share code, notes, and snippets.

💭
Just coding

Kyle Simpson getify

💭
Just coding
Block or report user

Report or block getify

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:252062
<script src='LABjs/LAB.min.js'></script>
<script>
<!--
$LAB
.setOptions({BasePath:'/syntaxhighlight/js/'})
.script('shCore.js',
'shBrushCpp.js',
'shBrushCss.js',
'shBrushJScript.js',
'shBrushPython.js',
View gist:288295
function cloneObj(obj) {
var clone;
if (Object.prototype.toString.call(obj) === "[object Array]") {
clone = [];
for (var i=0, len=obj.length; i<len; i++) {
clone[i] = cloneObj(obj[i]);
}
}
else if (obj == null) {
clone = obj;
View gist:297845
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Custom Error Objects in JavaScript</title>
</head>
<body>
<h1>Custom Error Objects in JavaScript</h1>
View gist:303128
(function(){
alert(window); // "undefined"
var window = window;
})();
View gist:303133
// for FF only
setTimeout(function(rand){ alert(rand); },10); // FF passes a "magic" param we call "rand"
for (var i=0; i<100000; i++) { i; } // take some time
View gist:305023
(function(){
var x = y = 1;
})();
alert(x); // undefined
alert(y); // 1 -- oops, auto-global!
View engine.cpp
#include <v8.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <engine.h>
// Extracts a C string from a V8 Utf8Value.
const char* ToCString(const v8::String::Utf8Value& value) {
View gist:305353
(function(global){
var undef;
function Promise(){}
Promise.prototype.constructor = Promise;
global.promise = function(cb) {
var publicAPI, queue = [], old_ret, promise_fulfilled = false;
function fulfill(val) {
var ret_val = val;
View gist:305934
var Require = function() {
function NativeRequire(module) {
var source;
// read source from file
if (!FS) {
source = imports.FSREAD("modules/fs.js");
FS = Function.apply(Function,imports_names.concat([source])).apply(Function,imports_funcs);
}
View gist:309517
function cloneObj(obj) {
var clone;
if (Object.prototype.toString.call(obj) === "[object Array]") {
clone = [];
for (var i=0, len=obj.length; i<len; i++) {
clone[i] = cloneObj(obj[i]);
}
}
else if (obj == null) {
clone = obj;
You can’t perform that action at this time.