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 "rspec/core" | |
| module RSpec | |
| class << Core::Runner | |
| # SIGINT callback (installed by trap_interrupt) | |
| undef handle_interrupt | |
| def handle_interrupt | |
| if RSpec.world.wants_to_quit | |
| # The default way Ruby handles an interrupt signal. | |
| # Makes current example fail with this exception as a cause. |
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
| select n, delay, sum(delay) over (order by n) total_delay from ( | |
| select n, make_interval(secs => (pow(n, 4) + 2)::int) delay from generate_series(1, 20) n | |
| ) _; |
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
| create extension if not exists hstore; | |
| create table if not exists test_array as | |
| select id, '{"A","B","C"}'::varchar[] || id::varchar as codes from generate_series(1, 100000) id; | |
| create table if not exists test_hstore as | |
| select id, '"A"=>t,"B"=>t,"C"=>t'::hstore || hstore(id::varchar, 't') as codes from generate_series(1, 100000) id; | |
| create table if not exists test_jsonb as | |
| select id, '{"A":true,"B":true,"C":true}'::jsonb || jsonb_build_object(id::varchar, true) as codes from generate_series(1, 100000) id; | |
| \timing on |
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
| ; Compare vector vs list: | |
| cljs.user=> (simple-benchmark [nums (into (vector) (range 9999))] (nth nums 5000) 1000) | |
| [nums (into (vector) (range 9999))], (nth nums 5000), 1000 runs, 2 msecs | |
| nil | |
| cljs.user=> (simple-benchmark [nums (into (list) (range 9999))] (nth nums 5000) 1000) | |
| [nums (into (list) (range 9999))], (nth nums 5000), 1000 runs, 240 msecs | |
| nil | |
| ; It looks similar to let: |
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
| gem "nokogiri", "~> 1.6.0" | |
| require "nokogiri" | |
| Nokogiri::XML::Searchable.module_eval do | |
| def value_of(*args) | |
| a = search(*args).first | |
| a && a.content | |
| end | |
| alias :content_of :value_of | |
| 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 "thread" | |
| mutex = Mutex.new | |
| i = 0 | |
| while true | |
| i += 1 | |
| Thread.new(i) do |n| | |
| mutex.synchronize do | |
| puts "#{n}. started request" |
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
| options system: false, cleanup: 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
| # encoding: UTF-8 | |
| ENV["RAILS_ENV"] = "test" | |
| require File.expand_path("../dummy/config/environment.rb", __FILE__) | |
| require "rails/test_help" | |
| Rails.backtrace_cleaner.remove_silencers! | |
| class HelloControllerTest < ActionController::TestCase | |
| def test_links | |
| @request.host = "example.com" |
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
| gem "dragonfly", "~> 0.9.14" | |
| require "dragonfly" | |
| img = Dragonfly[:images] | |
| img.datastore = Dragonfly::DataStorage::S3DataStore.new( | |
| access_key_id: ENV['AWS_ACCESS_KEY_ID'], | |
| secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | |
| bucket_name: ENV['S3_BUCKET_NAME'] | |
| ) |
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
| Processor Information: | |
| Model: MacBookAir4,2 | |
| Vendor: GenuineIntel | |
| Speed: 1800 Mhz | |
| 4 logical processors | |
| 2 physical processors | |
| HyperThreading: Supported | |
| FCMOV: Supported | |
| SSE2: Supported | |
| SSE3: Supported |
NewerOlder