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
IN = '/tmp/production.log' | |
OUT = '/tmp/render_time.tsv' | |
render_vals = File.read(IN).split("\n\n").map do |lines| | |
# render time | |
m = lines.match(/^Completed in (\d+)ms/) | |
next unless m | |
render_time = m.captures[0].to_i | |
# action and timestamp | |
m = lines.match(/^Processing (\S*) \(for \S* at ([^)]*)\)/) |
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
# app/models/telecom/circuits.rb | |
module Telecom::Circuits | |
def self.table_name_prefix | |
'telecom_circuits_' | |
end | |
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
Representative Pocan, | |
I'm writing to call on you to heed the words of our founding fathers, who warned us not to become entangled in foreign wars. I urge you to vote against any authorization for use of force in Syria. | |
Our history of choosing sides in revolutions has brought nothing but misery to all parties involved, particularly in the Middle East (except perhaps to Israel). One look no further than exactly one year ago when Libyans in Benghazi burned down our consulate and murdered multiple American citizens, including ambassador to Libya Chris Stevens. This was after we spent over $1 billion helping oust Moammar Gaddafi from power, when we thought that we had done right by the Libyan people. | |
Even if well-intentioned, Arab people are rightfully suspicious of American intervention into their affairs due to our nasty history in that region. Specifically in regards to Syria, this intervention began in 1949 when the CIA supported a coup that installed Husni al-Za'im as dictator (see BBC article "The Bab |
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
Thank you for contacting me about the disclosure of the National | |
Security Agency's (NSA) intelligence gathering programs. It is good to | |
hear from you on this critical issue. | |
On June 6, 2013, news outlets reported on a large leak of classified | |
information by a contractor named Edward Snowden. In the following days | |
and weeks, more revelations have come to light, including troubling | |
surveillance practices by the NSA. I believe we now have an important | |
opportunity for a renewed debate around intelligence gathering | |
activities and their relationship to Americans' civil liberties, |
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
@foo # => #<Foo @id=1> | |
Foo.get(1) # => #<Foo @id=1> | |
Foo.get(1) == @foo # => false | |
@foo.as_json == Foo.get(1).as_json # => true | |
Foo.get(1) === @foo # => false | |
@foo.class # => Foo | |
Foo.get(1).class # => Foo | |
@foo.class == Foo.get(1).class # => false | |
@foo.class == Foo # => false |
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
#!/usr/bin/env ruby | |
n = 0 | |
while true | |
print '>> ' | |
gets.chomp.each_char do |c| | |
n = 0 if [-1, 256].include?(n) | |
case c | |
when 'd' then n -= 1 | |
when 'i' then n += 1 |
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
diff --git a/Gemfile.lock b/Gemfile.lock | |
index 267c383..6b33c37 100644 | |
--- a/Gemfile.lock | |
+++ b/Gemfile.lock | |
@@ -119,16 +119,16 @@ GEM | |
remote: http://rubygems.org/ | |
specs: | |
- actionmailer (3.2.13) | |
- actionpack (= 3.2.13) | |
- mail (~> 2.5.3) |
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 RateLimiter | |
include Celluloid | |
def initialize(actions_per, seconds) | |
@bucket, @nice = actions_per, seconds | |
end | |
def request | |
wait :bucket_increment unless @bucket > 0 | |
@bucket -= 1 |
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
$ rvm info | |
jruby-1.6.7.2@temp: | |
system: | |
uname: "Linux STAGING1 2.6.32-25-server #45-Ubuntu SMP Sat Oct 16 20:06:58 UTC 2010 x86_64 GNU/Linux" | |
system: "ubuntu/10.04/x86_64" | |
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)" | |
zsh: "/usr/bin/zsh => zsh 4.3.10 (x86_64-unknown-linux-gnu)" |
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
;(function() { | |
var Form = Backbone.Form, | |
editors = Form.editors; | |
// we don't want our nested form to have a (nested) <form> tag | |
// (currently bbf includes form tags: https://github.com/powmedia/backbone-forms/issues/8) | |
// aside from being strange html to have nested form tags, it causes submission-upon-enter | |
Form.setTemplates({ | |
nestedForm: '<div class="bbf-nested-form">{{fieldsets}}</div>' |