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
### INSTALLATION NOTES ### | |
# 1. Install Homebrew (https://github.com/mxcl/homebrew) | |
# 2. brew install zsh | |
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh) | |
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace | |
# 5. Install iTerm2 | |
# 6. In iTerm2 preferences for your profile set: | |
# Character Encoding: Unicode (UTF-8) | |
# Report Terminal Type: xterm-256color | |
# 7. Put itunesartist and itunestrack into PATH |
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 implementation of quicksort and mergesort in ruby | |
# Both algorithm sort in O(n * lg(n)) time | |
# Quicksort works inplace, where mergesort works in a new array | |
def quicksort(array, from=0, to=nil) | |
if to == nil | |
# Sort the whole array, by default | |
to = array.count - 1 | |
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
class MyApplication < Sinatra::Base | |
use Rack::Session::Cookie | |
use Warden::Manager do |manager| | |
manager.default_strategies :password | |
manager.failure_app = MyApplication | |
end | |
Warden::Manager.serialize_into_session{ |user| user.id } |
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
# Looks for the escaped fragment meta tag. If found, gets the HTML snapshot | |
# instead | |
module GoogleBotSimulator::EscapedFragment | |
def has_meta_fragment? | |
(@response.search('//meta[@name="fragment"]/@content').to_s == '!') ? true : false | |
end | |
def url_with_escaped_fragment(url) |
We are building a set of applications that have will show deals (aka. 'inventory items') available in or near a given city. These items can also be organized by a 'category' (aka. tags), to cater to the various customers' areas of interest.
To bootstrap things, and to get us focussed on some key areas of developing in a SOA, we have gone ahead and built these apps out at varying stages. The workshops will focus on showing some of this code, and intersperse exercises to add features, or to refactor.
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 Api | |
module V2 | |
module Util | |
module CursorHelpers | |
extend ActiveSupport::Concern | |
# apply cursor-based pagination to a collection | |
# returns a hash: | |
# results: (paginated collection subset) | |
# next: (cursor to the next page) |
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
INSPIRATION: https://github.com/intridea/grape/issues/131#issuecomment-10413342 | |
File: config/application.rb | |
config.autoload_paths += %W(#{config.root}/app/api #{config.root}/app/api/*/*) | |
File: config/environments/development.rb | |
# Add below code before DummyApp::Application.configure BLOCK |
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
alias be="bundle exec" | |
alias ll="ls -la" | |
alias g='git' |