Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Buckman benbuckman

View GitHub Profile
@benbuckman
benbuckman / test-refs.js
Created Dec 4, 2012
Testing JS references
View test-refs.js
// is it possible to hold a reference to a wrapper's object,
// such that the reference automatically updates when the object updates?
// (rather than staying with the original object)?
var assert = require('assert');
function Wrapper(){
this.client = null;
};
View magicdictionary.coffee
dict = ['hello', 'kitty', 'farm']
isWordInDict = (word)->
(dict.indexOf(word) > -1)
findAllWords = (str)->
words = []
for startInd in [0..(str.length - 1)]
for endInd in [(startInd + 1)..str.length]
@benbuckman
benbuckman / seq-test.js
Created Dec 11, 2011
Understanding node-seq (control flow library for node.js)
View seq-test.js
### OUTPUT ###
vars at end: { firstVar: 'A', secondVar: 'B', thirdVar: 'C' }
in A
vars: {}
in B
vars: {}
timer done in A
in C
vars: {}
@benbuckman
benbuckman / drupal-syslog-parser.js
Created Nov 29, 2011
node.js script to parse Drupal logs in linux syslog (and find distinct 404'd URLs)
View drupal-syslog-parser.js
// drupal log parser w/ node.js
// takes a filtered syslog file
// run as node `drupal-syslog-parser.js LOGPATH`
// [install dependencies (lazy,underscore) first with `npm install ___`]
var lazy = require('lazy')
, fs = require('fs')
, path = require('path')
, _ = require('underscore');
View Drupal - Re-Sync Content Taxonomy.php
<?php
/**
* Implementation of hook_drush_command().
*/
function MODULE_drush_command() {
$items = array();
$items['resync-content-taxonomy'] = array(
'description' => "Re-sync content_taxonomy from term_node",
);
return $items;
View flickr-slideshow-code-generator.html
<!doctype html>
<!--
Flickr slideshow code generator.
Created by Ben Buckman, August 2014. Open source under MIT license.
-->
<html>
<head>
<title>Flickr Slideshow Generator</title>
<script>