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 'pp' | |
require 'aws-sdk' | |
require 'logger' | |
module RAWS | |
class Metrics | |
def initialize | |
config_path = '.riotaws.yml' | |
AWS.config({ | |
:access_key_id => 'A...', |
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
$ git branch -r --merged | | |
grep origin | | |
grep -Ev '>|master' | | |
xargs -L1 | | |
awk '{split($0,a,"/"); print a[2]}' | | |
xargs git push origin --delete |
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
function Chart() { | |
} | |
Chart.prototype = { | |
l_gutter: 120, | |
l_margin: 20, | |
r_margin: 20, | |
r_gutter: 80, | |
x_bound: 900, | |
t_gutter: 20, |
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
#Routes | |
map.resources :posts | |
map.resources :posts, :member => {:unpublish => :post} | |
#Posts controller | |
def unpublish | |
@post = Post.find(params[:id]) | |
@post.current_state = "unpublished" | |
@post.save | |
respond_to do |format| |
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 LabeledFormBuilder < ActionView::Helpers::FormBuilder | |
%w[text_field password_field select file_field text_area].each do |method_name| | |
alias_method("#{method_name}_without_randys_awesome", method_name) | |
define_method(method_name) do |field_name, *args| | |
content = '' | |
error = object.errors.on(field_name) | |
row_classes = 'form-row' | |
row_classes += ' error' unless error.blank? | |
label_classes = 'form-label' | |
label_classes += ' align' if %w|file_field select|.include?(method_name) |