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
| namespace :syntax do | |
| desc 'Checks the syntax of ERB files' | |
| task :erb do | |
| require 'action_view' | |
| Dir['app/views/**/*.erb'].each do |file| | |
| template = File.read(file) | |
| begin | |
| ActionView::Template::Handlers::Erubis \ |
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
| with Rubinius.synchronize: | |
| $ ./bin/benchmark core/file/bench_each_byte.rb | |
| === rbx === | |
| File#each_byte with a small file | |
| 29.1 (±0.0%) i/s - 146 in 5.023101s (cycle=2) | |
| File#each_byte with a medium file | |
| 3.3 (±0.0%) i/s - 17 in 5.228034s (cycle=1) | |
| File#each_byte with a large file | |
| 0.3 (±0.0%) i/s - 2 in 6.110730s (cycle=1) |
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
| desc: (none) | |
| cmd: ruby rss_growth_during_redis_publish.rb -n 1000000 | |
| time_unit: i | |
| #----------- | |
| snapshot=0 | |
| #----------- | |
| time=0 | |
| mem_heap_B=0 | |
| mem_heap_extra_B=0 | |
| mem_stacks_B=0 |
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
| diff --git a/rss_growth_during_redis_publish.rb b/rss_growth_during_redis_publish.rb | |
| index f6d1526..cecfdef 100755 | |
| --- a/rss_growth_during_redis_publish.rb | |
| +++ b/rss_growth_during_redis_publish.rb | |
| @@ -8,6 +8,14 @@ require 'celluloid/io' # Unclear if this is required, or if Celluloid will hand | |
| require 'celluloid/redis' | |
| require 'celluloid/autostart' | |
| +Thread.new do | |
| + loop do |
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
| # Since public domain doesn't exist everywhere in the world and people might | |
| # actually want to use this snippet here's the license (you can leave out | |
| # the lines preceding it): | |
| # | |
| # Copyright (c) 2014, Yorick Peterse | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
| #!/usr/bin/env bash | |
| # Small wrapper around the actual command used to start the daemon. This | |
| # wrapper allows us to set various environment variables before Ruby is | |
| # started. | |
| # | |
| # See the following URLs for more information on these options and their | |
| # values: | |
| # | |
| # http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production |
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
| [yorickpeterse in oga]$ pry -r ./lib/oga | |
| 2.1.2p95 > Oga::XPath::Parser.new('/div[@class="container"]/div[@class="review"]').parse | |
| => (xpath | |
| (path | |
| (name nil "div") | |
| (eq | |
| (axis "attribute" "class") | |
| (string "container"))) | |
| (path | |
| (name nil "div") |
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
| 2.1.2p95 > require 'csv' | |
| => true | |
| 2.1.2p95 > headers = %w{foo bar} | |
| => ["foo", "bar"] | |
| 2.1.2p95 > row = CSV::Row.new(headers, [10, 20]) | |
| => #<CSV::Row "foo":10 "bar":20> | |
| 2.1.2p95 > headers.map(&:frozen?) | |
| => [true, true] | |
| 2.1.2p95 > headers.first.upcase! | |
| RuntimeError: can't modify frozen String |
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 'gir_ffi-gtk3' | |
| require 'sequel' | |
| GirFFI.setup :GtkSource | |
| Gtk.init | |
| Thread.abort_on_exception = true | |
| client = Sequel.connect( |
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
| package main | |
| import ( | |
| "github.com/conformal/gotk3/gtk" | |
| "os" | |
| "path" | |
| ) | |
| func main() { | |
| gtk.Init(nil) |
OlderNewer