Skip to content

Instantly share code, notes, and snippets.

View philharvey's full-sized avatar

Phil Harvey philharvey

  • Nashville, TN
View GitHub Profile
function I(x) { return x; }
function walk(obj, pre, post) {
var k, v;
obj = (pre||I)(obj);
if (typeof(obj) === 'object') {
for (k in obj) if (obj.hasOwnProperty(k)) {
v = (post||I)(walk(obj[k], pre, post));
if (v === undefined) {
delete obj[k];
@JonKernPA
JonKernPA / idea.rb
Created August 4, 2010 18:00
This shows A User/Idea/Rating model using MongoMapper
class Idea
include MongoMapper::Document
key :brilliance, String, :default => "Dark Matter Sucks!"
many :ratings
belongs_to :user
key :user_id, ObjectId
def to_s
text = "#{user.name} had this IDEA: #{brilliance}\n\tRATINGS:\n"
ratings.each do |r|
class Blog
include MongoMapper::Document
# Attributes ::::::::::::::::::::::::::::::::::::::::::::::::::::::
key :title, String
key :category_id, ObjectId
key :archive_after, Time
# Assocations :::::::::::::::::::::::::::::::::::::::::::::::::::::
belongs_to :category
@hjr3
hjr3 / e-commerce.md
Created April 3, 2012 05:35
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active July 20, 2024 05:10
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@philharvey
philharvey / 1-restdesk-example-one.md
Created September 22, 2012 17:14
REST & Hypermedia - "RESTDesk" Examples - Ruby Hoedown 2012

RESTDesk: First version

Business use case:

  • Allow app users for our single iPhone app to report bugs/feature requests via a native, in app help desk UI.
  • Users can report issues for our development team to address.

Non-hypermedia version

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@killercup
killercup / pandoc.css
Created July 3, 2013 11:31
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@jbenet
jbenet / simple-git-branching-model.md
Last active June 17, 2024 14:53
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.