Skip to content

Instantly share code, notes, and snippets.

View mikekelly's full-sized avatar

Mike Kelly mikekelly

View GitHub Profile
@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

@kmayer
kmayer / brand_sweeper.rb
Created March 31, 2012 18:53
TDD Action Caching in Rails 3
class BrandSweeper < ActionController::Caching::Sweeper
observe Brand # Observers will introspect on the class, but Sweepers don't
def after_update(brand)
expire_action :controller => "brand", :action => :preview, :brand_id => brand.to_param
end
...
@peternixey
peternixey / securing_rails_updates.md
Created March 5, 2012 13:10
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


~/Code/ember.js ‹ruby-1.9.3› ‹master*› $ bundle && echo "fuck you giles"
Using rake (0.9.2.2)
Using confparser (0.0.2.1)
Using multi_json (1.0.4)
Using execjs (1.2.13)
Using libxml-ruby (2.2.2)
Using faster_xml_simple (0.5.0)
Using httpclient (2.2.4)
Using json (1.6.5)
Using nokogiri (1.5.0)
@lusis
lusis / autostart.md
Created February 2, 2012 05:36
Why autostarting default config packages are a bad thing

For a moment, I'm going to throw away my automation and configuration management hat. I'll let you know when I put it back on. Also, let's ignore that we're talking about Riak specifically for a moment. Also also, let's ignore any (for a brief moment) the proper role of a package manager.

What's your target market?

If you're writing server software, you have two target markets. The system administrator/operations team and the developer.

Why do you want autostart?

The main reason you want autostart is to get people up and running quickly. To do this, you need to ship safe and sane defaults. This means something like a default configuration that listens only on localhost.

@brentertz
brentertz / rvm2rbenv.txt
Created November 21, 2011 23:00
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@moiristo
moiristo / gist:1245170
Created September 27, 2011 14:27
Rails3 way to redirect non-www domain to www domain
# Rails3 way to redirect non-www domain to www domain
# Single domain redirect
'example.com'.tap do |host|
constraints(:host => host) do
match '/(*path)', :to => redirect { |params, request| Addressable::URI.escape request.url.sub(host, "www.#{host}") }
end
end
@chriseppstein
chriseppstein / 0_selector_hacks.scss
Created September 14, 2011 04:27
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard