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/app/account.rb b/app/account.rb | |
index a108685..c89ad34 100644 | |
--- a/app/account.rb | |
+++ b/app/account.rb | |
@@ -1,4 +1,22 @@ | |
+require 'open-uri' | |
+ | |
module Sol | |
+ class Url | |
+ def self.get(url) |
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
module ActiveModel::Validations | |
class EmailWithMxValidator < ActiveModel::Validations::EmailValidator | |
def validate_each(*args) | |
super | |
check_for_mx(*args) | |
end | |
def check_for_mx(record, attribute, value) | |
record.errors.add attribute, 'MX not found' unless options[:mock_mx] | |
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
set :shared_children, shared_children << 'tmp/sockets' | |
namespace :deploy do | |
desc "Start the application" | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false | |
end | |
desc "Stop the application" | |
task :stop, :roles => :app, :except => { :no_release => true } do |
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
>> ruby -y -e 'def hello; world; end' | |
Starting parse | |
Entering state 0 | |
Reducing stack by rule 1 (line 782): | |
-> $$ = nterm $@1 () | |
Stack now 0 | |
Entering state 2 | |
Reading a token: Next token is token keyword_def () | |
Shifting token keyword_def () | |
Entering state 7 |
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 Array | |
>> def each(&block) | |
>> reverse_each { |x| yield x } | |
>> end | |
>> end | |
=> nil | |
>> [1,2,3].each { |a| puts a } | |
3 | |
2 | |
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
#!/usr/bin/env dtrace -s | |
/* | |
* DTrace script to observe UNIX socket reads/writes for RubyMotion apps running | |
* in the iOS Simulator. | |
* | |
* Usage: sudo dtrace_rubymotion_repl <pid of running RubyMotion iOS app> | |
* | |
*/ | |
syscall::sendto:entry |
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
Originally: | |
https://gist.github.com/7565976a89d5da1511ce | |
Hi Donald (and Martin), | |
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I | |
appreciate the tone. This is a Yegge-long response, but given that you and | |
Martin are the two people best-situated to do anything about this, I'd rather | |
err on the side of giving you too much to think about. I realize I'm being very | |
critical of something in which you've invested a great deal (both financially |
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
# routes, api_version is provided by the biceps gem | |
My::Application.routes.draw do | |
api_version 1 do | |
resources :users | |
end | |
api_version 2 do | |
resources :users | |
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
Day job: Lead Dev at @Leadformance | |
Your Rails contributions (if any): 26 commits, [#84](http://contributors.rubyonrails.org/contributors/franck-verrot/commits) | |
What's your Ruby/Rail experience?: ± 4-5 years | |
How do you use GitHub?: Professionnal and Personal projects, both paid accounts. Lots of contributions too. |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'net/http' | |
require 'cgi' | |
res = Net::HTTP.get 'maps.google.co.uk','/maps/ms?ie=UTF8&oe=UTF8&msa=0&output=kml&msid=207192798388318292131.0004aa01af6748773e8f7' | |
doc = Nokogiri::XML(res) | |
placemarks = doc.css('Placemark') | |
puts "Name\tLatitude\tLongitude\tDescription" | |
placemarks.each do |placemark| | |
description = CGI::escapeHTML(placemark.css('description').first.content) |