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
# places/index.rabl | |
object false | |
node(:total_entries) { @places.total_entries} | |
node(:total_pages) { @places.total_pages} | |
node(:current_page) { @places.current_page} | |
node(:per_page) { @places.per_page} | |
node :places do | |
@places.map { |place| {:place => partial('api/v1/places/show', :object => place)} } | |
end | |
node(:links) do |
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
def redirect_if_current_locale_not_requested_locale | |
if session[:requested_locale].present? && Language::SUPPORTED_LANGUAGES.include?(session[:requested_locale].to_sym) | |
if geo_locator_slug = GeoLocatorSlug.find_by_slug_and_language(params[:locator_slug], session.delete(:requested_locale).to_sym) | |
geo_locator_slug = geo_locator_slug.slug_for_new_language(current_language) | |
redirect_to locator_path(geo_locator_slug.to_param) if geo_locator_slug.present? | |
end | |
end | |
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
@timer = Time.now | |
def log(line) | |
puts "#{(Time.now - @timer).round(4)} #{line}" | |
@timer = Time.now | |
end | |
module Kernel | |
def require_logged(required, *args) | |
puts "require(#{required})" | |
require_not_logged(required, *args) |
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
module CalculateUntilSaved | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def calculate_until_saved(attribute_name) | |
attr_protected attribute_name |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
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
# Optimized for writes, sort on read | |
# LVC | |
redis.hset("bonds|1", "bid_price", 96.01) | |
redis.hset("bonds|1", "ask_price", 97.53) | |
redis.hset("bonds|2", "bid_price", 95.50) | |
redis.hset("bonds|2", "ask_price", 98.25) | |
redis.sadd("bond_ids", 1) | |
redis.sadd("bond_ids", 2) |
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
Show hidden characters
[ | |
{ "keys": ["ctrl+shift+b"], "command": "git_blame" }, | |
{ "keys": ["ctrl+w"], "command": "find_under_expand" }, | |
{ "keys": ["super+ctrl+r"], "command": "reveal_in_side_bar" }, | |
{ "keys": ["super+ctrl+w"], "command": "close_all" }, | |
{ "keys": ["super+shift+t"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, | |
{ "keys": ["ctrl+shift+d"], "command": "duplicate_line" }, | |
{ "keys": ["ctrl+l"], "command": "insert", "args": {"characters": " => "} }, | |
{ "keys": ["super+shift+l"], "command": "expand_selection", "args": {"to": "line"} }, | |
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, |
This file has been truncated, but you can view the full file.
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
0.1186665000 0000000004 1499999999 9999999195 8313039789 0630162499 9999999999 9999138089 3110577409 2150528461 8283188471 8502009569 6272489499 9999999999 9999973276 4779187664 3022516776 0716064407 1430666530 2283343930 0971513507 7248999367 1478966528 3850326553 0047597210 8854924082 1222516463 0500000000 0000000000 1851712948 1791659549 2210564072 0557814614 7269867466 8876461403 2946271574 6826228847 6502376014 2036986311 7669628225 0465744053 6162070699 3383929906 8952268320 2939559792 2099858573 7081241398 2852916117 3330548056 7010688743 0098470955 0575470505 1660601032 7930673768 6477691379 2028027334 9999999999 9999999315 5923982360 2678802063 6066448064 0589602908 6522182082 3380627031 2195025795 9755552844 3663259899 3008886307 0046642008 2617014047 0294802213 1632917492 2868148700 3153739921 7451243429 7011224235 6921036054 5162263573 5097966665 0011309966 1959612344 6865712351 9543306906 5670545633 0200088811 0878220993 2594708637 4349396955 7928963097 2249471652 5730828340 0701203895 0540492708 |
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 'test_helper' | |
class MyHelperTest < ActionView::TestCase | |
test "title" do | |
assert_select_in '<h1>My Awesome App</h1>', 'h1' | |
end | |
test "nav" do | |
html = '<div id="nav"><a href="/">Home</a></div>' | |
assert_select_in html, 'div' do |