View condition_builder.rb
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
# Condition Builder for ActiveRecord | |
# | |
# (c) 2005-2006 Ezra Zygmuntovic, Jens-Christian Fischer and Duane Johnson | |
# distributed under the same license as Ruby On Rails | |
# | |
# Version 1.1 | |
# | |
# Jan 4, 2007: Added "AND" and "OR" using 'and' and 'or'. Also added ability to use sub-conditions | |
# e.g. | |
# Condition.block { |c| |
View _flash.sass
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
/* flash-messages | |
#flash | |
left: 0 | |
margin: 0 auto | |
position: absolute | |
text-align: center | |
top: 0 | |
width: 100% | |
z-index: 1000 |
View gist:1067444
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
:vimgrep regex path | |
#example to find all ruby files using "belongs"to | |
:vimgrep /belongs_to/ **/*.rb | |
:cnext | |
:cprevious |
View application.html
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script> | |
<script> | |
//<![CDATA[ | |
window.jQuery || document.write("<script src='/javascripts/jquery.min.js'>\x3C/script>") | |
//]]> | |
</script> |
View registrations_controller.rb
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::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
View burrito_delicious_policy.rb
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 BurritoDeliciousPolicy | |
def delicious?(burrito) | |
burrito.guacamole? | |
end | |
end |
View burro.rb
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 Burro < ActiveRecord::Base | |
#guacamole defined on schema | |
def delicious? | |
BurroDeliciousPolicy.new(self).delicious? | |
end | |
end |
View APIcall.json
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
POST https://app.zencoder.com/api/v2/jobs HTTP/1.1 | |
Accept: application/json | |
Content-Type: application/json | |
{ | |
"api_key": "API_KEY_HERE", | |
"input": "PUBLIC_FILE_URL_HERE", | |
"private": true, | |
"output": [ | |
{ |
View active_admin_support_for_mongoid.rb
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 "active_admin" | |
require "active_admin/resource_controller" | |
module ActiveAdmin | |
class Namespace | |
# Disable comments | |
def comments? | |
false | |
end | |
end |
View gist:1546140
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
#!/bin/sh | |
set -u | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
APP_ROOT=/home/deploy/public_html/rm/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENV=production |
OlderNewer