Skip to content

Instantly share code, notes, and snippets.

View qrush's full-sized avatar
🕸️
Making internets

Nick Quaranto qrush

🕸️
Making internets
View GitHub Profile
@qrush
qrush / 2015.txt
Last active August 29, 2015 13:57
RubyGems.org Feb Push Stats
irb(main):004:0> pp Version.where("created_at > ? and created_at < ?", DateTime.parse("01 Feb 2015"), DateTime.parse("01 Mar 2015")).count
11374
=> 11374
406.2142857142857 avg for feb 2015
irb(main):005:0> pp Version.where("created_at > ? and created_at < ?", DateTime.parse("01 Mar 2015"), DateTime.parse("01 Apr 2015")).count
12522
=> 12522
irb(main):002:0> class Foo; class_attribute :bar; end
=> [:bar]
irb(main):006:0> Foo.bar = "LOL"
=> "LOL"
irb(main):007:0> Foo.bar
=> "LOL"
irb(main):008:0> Foo.new.bar
=> "LOL"
@qrush
qrush / gist:10401517
Created April 10, 2014 16:51
Replace tabs with 4 spaces, remove leading spaces/tabs for Objective-C .m, .h files
find . -name "*.[mh]" | while read line; do expand -t 4 $line > $line.new; mv $line.new $line; done
find . -name "*.[mh]" | while read line; do git stripspace < $line > $line.new; mv $line.new $line; done
SET I
Skyway
20/20
The Median #
Complex
Super Mario Brothers Theme
All In ^,
Complex II * >
Origami
ABACAB **
2014-05-20T01:50:11.439918+00:00 app[web.1]: 54.245.153.90 - - [20/May/2014 01:50:11] "POST /hook HTTP/1.1" 500 30 132.3713
2014-05-20T01:51:24.185896+00:00 app[web.1]: Errno::ETIMEDOUT - Connection timed out - connect(2):
2014-05-20T01:51:24.185902+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `initialize'
2014-05-20T01:51:24.185904+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `open'
2014-05-20T01:51:24.185906+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
2014-05-20T01:51:24.185907+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
2014-05-20T01:51:24.185909+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:877:in `connect'
2014-05-20T01:51:24.185910+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
2014-05-20T01:51:24.185912+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:851:in `start'
2014
2014-05-20T02:39:10.388557+00:00 app[web.1]: Twitter::Error::Forbidden - Status is over 140 characters.:
2014-05-20T02:39:10.388564+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/twitter-4.8.1/lib/twitter/response/raise_error.rb:21:in `on_complete'
2014-05-20T02:39:10.388567+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/response.rb:9:in `block in call'
2014-05-20T02:39:10.388569+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/response.rb:63:in `on_complete'
2014-05-20T02:39:10.388570+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
2014-05-20T02:39:10.388572+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/request/url_encoded.rb:14:in `call'
2014-05-20T02:39:10.388574+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/request/multipart.rb:13:in `call'
2014-05-20T02:39:10.388575+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.
export C_INCLUDE_PATH="$(xcrun --show-sdk-path)/usr/include"
export CPLUS_INCLUDE_PATH="$(xcrun --show-sdk-path)/usr/include"
export LIBRARY_PATH="$(xcrun --show-sdk-path)/usr/lib:$(xcrun --show-sdk-path)/usr/lib/system:$LIBRARY_PATH"
@qrush
qrush / pow_with_xcode_ci.conf
Last active August 29, 2015 14:01
Run Pow and Apache with Xcode CI bots
<VirtualHost *:80>
Alias /__xcsweb/xcswebxcode /Applications/Server.app/Contents/ServerRoot/usr/share/xcodeserver/web/desktop
Alias /__xcsweb/xcswebbase /Applications/Server.app/Contents/ServerRoot/usr/share/xcodeserver/web/base
Alias /__xcsweb/bigscreen /Applications/Server.app/Contents/ServerRoot/usr/share/xcodeserver/web/bigscreen
ProxyPass /__xcsweb/xcswebxcode !
ProxyPass /__xcsweb/xcswebbase !
ProxyPass /__xcsweb/bigscreen !
ProxyPass /xcs/svc http://localhost:4444/svc
class AddPriceToProduct < ActiveRecord::Migration
def self.up
options = {:precision => 8, :scale => 2, :default => 0}
add_column :products, :decimal, options
add_column :price, :decimal, options
end
def self.down
remove_column :products, :price
def self.find_by_permalink(link)
cat = nil
if link.to_i == 0
cat = Category.find_by_name(link.gsub(/ /, "-").titlecase)
else
cat = Category.find(link)
end