This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApiController < ActionController::Metal | |
include ActionController::Helpers | |
include ActionController::Redirecting | |
include ActionController::Rendering | |
include ActionController::Renderers::All | |
include ActionController::ConditionalGet | |
include ActionController::MimeResponds | |
include ActionController::RequestForgeryProtection | |
include ActionController::ForceSSL | |
include AbstractController::Callbacks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App.Collections.Contacts extends Backbone.Collection | |
url: "/api/contacts" | |
model: App.Models.Contact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Api::ContactsController < ApiController | |
before_filter :authenticate_user! | |
def index | |
# magic goes here ... | |
end | |
# more magic ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar -xvzf ruby-1.9.3-p194.tar.gz | |
cd ruby-1.9.3-p194/ | |
./configure --prefix=/usr/local | |
make | |
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApiController < ActionController::Metal | |
include ActionController::Helpers | |
include ActionController::Redirecting | |
include ActionController::Rendering | |
include ActionController::Renderers::All | |
include ActionController::ConditionalGet | |
include ActionController::MimeResponds | |
include ActionController::RequestForgeryProtection | |
include ActionController::ForceSSL | |
include AbstractController::Callbacks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add these to your test group | |
group :test do | |
gem 'capybara' | |
gem 'poltergeist' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
class AgeGroup < Struct.new(:categories) | |
# def | |
# Hash[*AGE_CATEGORIES.keys | |
# .map { |r| r.map { |v| | |
# [v, AGE_CATEGORIES.select | |
# { |k, val| | |
# k.include?(v) | |
# }.values.first] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'pry' | |
class Fizzbuzz | |
def initialize(number) | |
@number = number | |
end | |
def self.count(number) | |
count = new(number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/init/change_this_to_your_app_name.conf | |
description "App Name" | |
author "Admin Name <admin@app.com>" | |
start on virtual-filesystems | |
stop on runlevel [06] | |
env PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:/usr/bin:/bin | |
env RAILS_ENV=staging # what environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample verbose configuration file for Unicorn (not Rack) | |
# | |
# This configuration file documents many features of Unicorn | |
# that may not be needed for some applications. See | |
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb | |
# for a much simpler configuration file. | |
# | |
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete | |
# documentation. |