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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Backbone game of life</title> | |
<meta charset='utf-8' /> | |
<script type='text/javascript' src='jquery.js'> </script> | |
<script type='text/javascript' src='underscore.js'> </script> | |
<script type='text/javascript' src='backbone.js'> </script> | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" > | |
<ImageView | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content" | |
android:src="@drawable/red" | |
android:adjustViewBounds="true"/> |
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
resource "Order" do | |
let(:client) { RspecApiDocumentation::TestClient.new(self, :headers => { "HTTP_ACCEPT" => "application/json", "CONTENT_TYPE" => "application/json" }) } | |
post "/orders" do | |
parameter :name, "Order name" | |
let(:name) { "New order" } | |
let(:raw_post) { params.to_json } |
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
source :rubygems | |
gem 'webmachine' | |
gem 'rspec' | |
gem 'rspec_api_documentation' | |
gem 'rack-test' | |
gem 'json_spec' |
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
Feature: Use OAuth2 MAC client as a test client | |
Background: # features/oauth2_mac_client.feature:2 | |
Given a file named "app_spec.rb" with: # aruba-0.4.11/lib/aruba/cucumber.rb:15 | |
""" | |
require "rspec_api_documentation" | |
require "rspec_api_documentation/dsl" | |
require "rack/builder" | |
RspecApiDocumentation.configure do |config| |
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
ActiveSupport::Notifications.subscribe(/my_class$/) do |*args| | |
event = ActiveSupport::Notifications::Event.new(*args) | |
Rails.logger.warn "%7.2fms %s" % [event.duration, event.name] | |
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 ParallelTestAdapter < Faraday::Adapter::Test | |
self.supports_parallel = true | |
def self.setup_parallel_manager | |
OpenStruct.new | |
end | |
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
require 'faraday' | |
require 'json' | |
def hash_password_for_private_key(password, sha_klass = OpenSSL::Digest::SHA256) | |
sha256 = sha_klass.new | |
1000.times.inject(password) do |hash, _| | |
sha256.hexdigest(hash) | |
end | |
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
require 'openssl' | |
require 'benchmark' | |
data = "Hello, world!" | |
Benchmark.bm do |x| | |
x.report do | |
private_key = OpenSSL::PKey::RSA.new 4096 | |
public_key = private_key.public_key |
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
private_key = "..." | |
client_email = "..." | |
bucket = "..." | |
path = "..." | |
full_path = "/#{bucket}/#{path}" | |
expiration = 5.minutes.from_now.to_i | |
signature_string = [ | |
"GET", |
OlderNewer