This file contains hidden or 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
rvm env . -- --env > .powenv |
This file contains hidden or 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 ruby | |
file = ARGV.shift | |
parameters = ARGV | |
unless file && !parameters.empty? | |
puts <<-end_usage | |
Usage #{$0} logfile param [param, ...] | |
Reads a rails log and extracts the given parameters, prints CSV. | |
Useful to include [action, controller] in parameters. |
This file contains hidden or 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
jQuery(function($){ | |
$('.toggle.hidden').hide(); | |
$(document).on('click','.toggle_button', function(){ | |
$(this).parent().find('.toggle').fadeToggle(); | |
}); | |
}); |
This file contains hidden or 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
{ | |
"color_scheme": "Packages/Color Scheme - Default/SpaceCadet.tmTheme", | |
"default_line_ending": "unix", | |
"draw_white_space": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 14.0, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, | |
"show_tab_close_buttons": false, | |
"tab_size": 2, |
This file contains hidden or 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
Node = Struct.new(:value, :left, :right) | |
node = Node.new(24, Node.new(12, Node.new(10), Node.new(14)), Node.new(28, nil, Node.new(30))) | |
def values(node) | |
return [] if node.nil? | |
[values(node.left), | |
node.value, | |
values(node.right)].flatten | |
end |
This file contains hidden or 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 Proc | |
def bind(receiver) | |
unbound_method = receiver.class.unbound_method self | |
unbound_method.bind receiver | |
end | |
end | |
class Object | |
def self.unbound_method(proc) | |
define_method :__temp_unbound_method__, &proc |
This file contains hidden or 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 PostPolicy < Struct.new(:user, :post) | |
def update? | |
post.user == user | |
end | |
def destroy? | |
false | |
end | |
def show? | |
true | |
end |
This file contains hidden or 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
{ | |
"color_scheme": "Packages/Color Scheme - Default/SpaceCadet.tmTheme", | |
"default_line_ending": "unix", | |
"draw_white_space": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 15.0, | |
"highlight_column": true, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, | |
"show_tab_close_buttons": false, |
This file contains hidden or 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
alias ls='ls -F' | |
alias ll='ls -l' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias lsa='ls -al' |
This file contains hidden or 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 GoalsController < ApplicationController | |
respond_to :html, :json | |
before_action :set_goal, only: [:show, :edit, :update] | |
def show | |
respond_with @goal | |
end | |
def edit | |
respond_with @goal |