Skip to content

Instantly share code, notes, and snippets.

View barberboy's full-sized avatar

Ben Barber barberboy

View GitHub Profile
@barberboy
barberboy / Cities_Collin.geojson
Last active June 7, 2018 21:45
Dallas Zipcodes and Cities
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@barberboy
barberboy / apple-touch-icon-black.png
Last active November 14, 2018 23:38
LiveBy Here™
apple-touch-icon-black.png
for(i=0;++i<101;)console.log(eval(String.fromCharCode(...'286925333f27273a2746697a7a27292b286925353f27273a2742757a7a27297c7c69'.match(/../g).map(n=>parseInt(n,16)))))
@barberboy
barberboy / rock-paper-scissors.js
Last active April 24, 2018 14:49
Rock Paper Scissors
#!/usr/bin/env node
/**
* Rock Paper Scissors
* ====================
* Rock, paper, scissors on the command line with JavaScript/Node.js/readline.
*
* Usage
* -----
* Place somewhere in path and make it executable
* (`chmod u+x ~/bin/rock-paper-scissors.js`).
@barberboy
barberboy / README.markdown
Last active September 30, 2015 19:34
vNKvvY
@barberboy
barberboy / format-date.js
Created June 29, 2015 22:31
Format Date (based on PHP date format)
/**
* formatDate(date, format)
* ========================
* Returns a string representation of `date`, formatted according to the given
* `format` string based on [PHP date format](http://php.net/manual/en/function.date.php).
*/
var weekdays = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' ')
var months = 'January February March April May June July August September October November December'.split(' ')
var pad = n => (+n < 10 ? '0' : '') + n
var formats = {
@barberboy
barberboy / xhr-utils.js
Created February 2, 2015 18:04
XHR Utils
/**
* getJSON( path, callback )
* -------------------------
* Asynchronously fetch and parse a JSON file.
*
* - path : A String specifying the location of the JSON file.
* - callback( data ): A Function to be executed when the JSON file is retrieved
* and parsed. The function will be passed the following
* arguments:
*
@barberboy
barberboy / README.markdown
Last active December 17, 2015 17:18
Ajax Example

Ajax Example

This is a simple example of using ajax to fetch content and add it to the page.

@barberboy
barberboy / README.md
Created August 17, 2012 15:47
Ninety-Nine Bottles of Beer

Ninety Nine Bottles of Beer

This is a coding exercise proposed by the estimable [Nathan Beenken] to code the song, "Ninety-nine Bottles of Beer", with the somewhat peculiarity of outputting the numbers in their English word form (ninety nine) rather than the simpler numeric form (99).

The exercise is two parts: 1) the song, and 2) the routine to convert numbers to their English word form.

if day is "Saturday"
sleep_late()
else
groan()