View symmetric-encryption.yml
# Symmetric Encryption for Ruby
# For the development and test environments the test symmetric encryption keys
# can be placed directly in the source code.
# And therefore no RSA private key is required
development: &development_defaults
key: 1234567890ABCDEF1234567890ABCDEF
iv: 1234567890ABCDEF
View curl
$ curl '' -H 'pragma: no-cache' -H 'accept-encoding: gzip, deflate, sdch' -H 'x-requested-with: XMLHttpRequest' -H 'accept-language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36' -H 'accept: */*' -H 'cache-control: no-cache' -H 'cookie: __utma=226841088.932423278.1426009571.1441109315.1455268828.7; __utmv=226841088.user; __utmz=226841088.1455268828.7.6.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); _ga=GA1.2.932423278.1426009571; _lipt=0_2D0HgoiQXLp395TkCpLQ7jRkeK2bNOXEPRTmrAUgK4_7wD_QxuYX_Jd-MIuTR2wAUgo2rtVuUloq03Ls10p3MGUEpnSgWJ-zhHd-iJAonlE3IquOSaa_szQwmPKw0oxqjL1EDeGq9avMcrbMpMpN1VjpnStE2ZRCwyI73eytlMEmtYyW_3Z9SKwAZhvLkz8C8LLWdVknsOKBNzOgWO7OwiyMGM-uwAqIKbNCpJs9M6n6vlZwg3FTRZ8wjkbRlbg2aFyBGo5zgTpb_TrnIKL8a0vYhSl5eNwlb3yjgM2-m9Y2PVTneq2GaqXxJ-ibTkkI8t63xOyPigFw4C9W6BTh0y; bcookie="v=2&2b3293b8-d3cf-4de5-80a8
View cookie
View sinatra_warden.rb
class MyApplication < Sinatra::Base
use Rack::Session::Cookie
use Warden::Manager do |manager|
manager.default_strategies :password
manager.failure_app = MyApplication
Warden::Manager.serialize_into_session{ |user| }
View escaped_fragment.rb
# Looks for the escaped fragment meta tag. If found, gets the HTML snapshot
# instead
module GoogleBotSimulator::EscapedFragment
def has_meta_fragment?
('//meta[@name="fragment"]/@content').to_s == '!') ? true : false
def url_with_escaped_fragment(url)

Rocky Mountain Ruby

SOA from the Start - Workshop Part

What will we show

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.

View cursor_helper.rb
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)
View Reload Grape API in Dev Env.rb
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

A Working configuration to setup HTML5 push-state routing in your AngularJS app with Nginx as your web server.

View gist:c5e13508365b44e1d108
require 'net/http'
require 'json'
uri = URI("")
payload = {
'description' => "My test gist",
'public' => true,
'files' => {
'test.txt' => {