Skip to content

Instantly share code, notes, and snippets.

View goatslacker's full-sized avatar

Josh Perez goatslacker

View GitHub Profile
@goatslacker
goatslacker / bfs-dfs-search.js
Created April 15, 2011 06:14
Depth First Search JS
var Search = {
opened: [],
closed: [],
/*
BFS: function (tree) {
this.opened.push(tree);
while (this.opened.length > 0) {
this.walkBFS(this.opened[0]);
@goatslacker
goatslacker / tiles.php
Created April 15, 2011 06:17
A tiles test
<?php
$tiles1 = array(
"11", // 1
"23",
"",
"44", // 2
"11",
"",
"16", // 3
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Using config file /home/josh/.jitsuconf
info: Executing command apps deploy
info: Authenticated as goatslacker
info: Analyzing your application dependencies in server.js
node.js:181
throw e; // process.nextTick error, or 'error' event on first tick
^
@goatslacker
goatslacker / node-rename-files
Created June 20, 2011 20:03
Rename a bunch of files in any given directory using random lipsum
#!/bin/env node
const fs = require('fs');
const path = process.argv.slice(2).shift() || ".";
const lipsum = (function () {
return "Lorem ipsum dolor sit amet consectetur adipiscing elit Vestibulum cursus diam nec leo pharetra id elementum enim egestas Nullam nec mauris justo id pharetra arcu Integer ut sapien sit amet tellus egestas molestie nec ornare turpis Mauris sed quam in elit blandit pulvinar vel nec leo Vivamus convallis aliquet mauris et cursus Aliquam bibendum eros vel erat pharetra nec varius ipsum molestie Curabitur elementum neque non tellus tempor dignissim Lorem ipsum dolor sit amet consectetur adipiscing elit Nunc dui nisl ullamcorper eu sagittis in cursus vel mauris Aliquam iaculis egestas libero sit amet lobortis metus porttitor quis Aliquam scelerisque vulputate libero vitae condimentum Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas Duis fringilla nisl eleifend lectus interdum id bibendum nibh ultricies Fusce quam mi semper vel sagittis et
@goatslacker
goatslacker / fishy stuff with jitsu
Created June 22, 2011 06:27
jitsu deploy err msg
josh@n0va:~/Development/nms-server-deploy$ jitsu apps start nms-server
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command apps start nms-server
info: Authenticated as goatslacker
info: Starting app nms-server
help:
help: Usage:
help: Starts the application in the current directory. If <name>
help: is supplied then that application is started instead.
@goatslacker
goatslacker / node-jsdiff
Created June 27, 2011 19:52
node-jsdiff - John Resig's Diff modified to work with NodeJS and output in colors
/*global module */
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
* Modified by Josh Perez <josh@goatslacker.com>
*
* Released under the MIT license.
*
* More Info:
@goatslacker
goatslacker / seqexec.js
Created June 27, 2011 23:05
Sequentially execute commands NodeJS
#!/usr/bin/env node
/*global require process */
const exec = require('child_process').exec;
/**
Returns a function to be executed
@param cmd {string} the command to run
@param callback {Function} the Function to execute after the command finishes running
*/
@goatslacker
goatslacker / andorsql
Created June 29, 2011 06:07
and/or sql builder
<script type="text/javascript">
var Search = {
opened: [],
closed: [],
or: [],
and: [],
DFS: function (tree) {
@goatslacker
goatslacker / about.md
Created August 9, 2011 21:54 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@goatslacker
goatslacker / diskspace.js
Created September 6, 2011 23:37
returns amount of space available on a system
const fs = require('fs');
const path = require('path');
// FIXME - performance issue: When checking a directory which contains MANY nested directories
// the performance of this script suffers...
// most commonly found with svn projects that are > 500mb.
// perhaps we're stacking the stack way too high and need to pile through it before we can continue
// to add to it?
/**