Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Trindall Trindaz

View GitHub Profile
@Trindaz
Trindaz / Circular reference JSON.stringify wrapper
Created Jan 28, 2013
Circular reference JSON.stringify wrapper
View Circular reference JSON.stringify wrapper
var repeatingArray = [4, 5, 6];
var circularObj = {
a: 1,
b: 1,
c: "an allowed repeating string",
d: "an allowed repeating string",
e: repeatingArray,
f: repeatingArray,
g: [
@Trindaz
Trindaz / gist:2234277
Created Mar 29, 2012
Javascript object deep copy
View gist:2234277
function processObjWithRef(obj, result){
if(obj==null || typeof obj != 'object'){
//nothing really to do here - you're going to lose the reference to result if you try an assignment
}
if(obj instanceof Array) {
for(var i=0; i<obj.length; i++){
result.push();
processObjWithRef(obj[i], result[i]);
}
}
View Delete branches older than one month locally and on remote.sh
for k in $(git branch | sed /\*/d); do
if [ -n "$(git log -1 --before='1 month ago' -s $k)" ]; then
git branch -D $k
git push origin --delete $k
fi
done
View .vimrc
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
View gist:5351594
<html>
<head>
<title>Side By Side Div Example</title>
<style>
div.left-column {
width: 20%;
min-width: 200px;
float: left;
background-color: yellow;
@Trindaz
Trindaz / gist:5351634
Created Apr 10, 2013
How do I make these two divs line up in the center?
View gist:5351634
<html>
<head>
<title>Side By Side Div Example</title>
<style>
div.left-column {
background-color: yellow;
display: inline;
}
@Trindaz
Trindaz / gist:5275435
Created Mar 30, 2013
package.json for jcrugzz
View gist:5275435
{
"name": "schema-website",
"version": "0.0.0-30",
"description": "ERROR: No README.md file found!",
"main": "server.js",
"dependencies": {
"async": "~0.2.5",
"consolidate": "~0.8.0",
"express": "~3.1.0",
"passport": "~0.1.15",
View gist:5060821
info: Creating snapshot 0.0.0-14
debug: { method: 'POST',
debug: uri: 'https://api.nodejitsu.com/apps/trindaz/schema-website/snapshots/0.0.0-14',
debug: headers:
debug: { Authorization: '*****************************************************************',
debug: 'Content-Type': 'application/octet-stream',
debug: 'Content-Length': 838180 },
debug: timeout: 240000 }
info Uploading: [=============================] 100%
debug: { statusCode: 201,
View gist:5060812
info: Creating snapshot 0.0.0-13
info Uploading: [=============================] 100%
info: Updating app schema-website
info: Activating snapshot 0.0.0-13 for schema-website
info: Starting app schema-website
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error:
error: There was an error while attempting to start the app
error: Error spawning drone
View gist:5060794
info: Creating snapshot 0.0.0-12
debug: { method: 'POST',
debug: uri: 'https://api.nodejitsu.com/apps/trindaz/schema-website/snapshots/0.0.0-12',
debug: headers:
debug: { Authorization: '*****************************************************************',
debug: 'Content-Type': 'application/octet-stream',
debug: 'Content-Length': 838178 },
debug: timeout: 240000 }
info Uploading: [=============================] 100%
debug: { statusCode: 500,
You can’t perform that action at this time.