Skip to content

Instantly share code, notes, and snippets.

@adamgibbons
adamgibbons / go-board-configurations.js
Last active August 29, 2015 14:15
Electrons in universe vs Go board configurations
(function totalElectrons() {
var total = Math.pow(10, 88); // 1.0000000000000001e+88
console.log(total + ' electrons in the universe');
})();
(function totalGoConfigurations() {
// 19 x 19 grid and three possibilities per
// intersection (black stone, white stone, empty)
var total = Math.pow(3, 19 * 19); // 1.740896506590319e+172
console.log(total + ' possible configurations on a Go board');
@adamgibbons
adamgibbons / node-pdf-generator.js
Last active December 22, 2022 17:38
Display or download PDF from node.js server
var restify = require('restify')
, port = process.env.PORT || 3000
, Phantom = require('phantom')
, tmpdir = require('os').tmpdir()
, fs = require('fs');
var server = restify.createServer();
function setResponseHeaders(res, filename) {
res.header('Content-disposition', 'inline; filename=' + filename);
@adamgibbons
adamgibbons / module-pattern.js
Created August 17, 2014 17:14
Module Pattern in JavaScript
// Module Pattern in JS
var FriendsModule = (function(){
// private vars and functions
var friends = ['Adam', 'Brittany', 'Russell', 'Erik', 'Hank'];
var addFriend = function(friend) {
friends.push(friend);
};
@adamgibbons
adamgibbons / product-101.md
Created August 11, 2014 22:54
Product 101 points

Roadmap paths

  • your-move
  • your-place
  • your-stuff
  • choose-quote
  • payment-book
  • payment
  • payment-confirmation
  • moving-day
  • feedback
@adamgibbons
adamgibbons / install-mongodb.md
Last active January 17, 2023 15:17
Install MongoDB on Mac OS X 10.9

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory:

@adamgibbons
adamgibbons / article-data-1
Created April 14, 2014 20:42
server response contains articles, articleSizes, and articleCompositions
.factory 'ArticleData', () ->
{
articles: [
{
"id" : "chair",
"name" : "Chair",
"parent" : "article"
},
{
"id" : "sofa",
@adamgibbons
adamgibbons / html5-css3-lesson-1
Created November 20, 2013 19:24
HTML5/CSS3 Class - Lesson 1
HTML - hyper text markup language
a set of markup tags that describe the content of a document/web page
doctype - instruction to browser as to what version of html will follow
tag
element
web browsers were created to read html documents and display them as web pages
@adamgibbons
adamgibbons / rename-files
Last active December 25, 2015 05:38
For all files in a directory, replace x with y.
#!/bin/bash
ls | while read -r FILE
do
mv -v "$FILE" `echo $FILE | tr 'x' 'y' `
done