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
Synvert::Rewriter.new "remote_rewriter", "Remote rewriter example" do | |
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
Synvert::Rewriter.new :use_taobao_gemsource do | |
within_file 'Gemfile' do | |
with_node type: 'send', message: 'source', arguments: {first: /rubygems.org/} do | |
replace_with 'source "http://ruby.taobao.org"' | |
end | |
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
R.input({ | |
placeholder: 'City', | |
className: 'form-control', | |
type: 'text', | |
onChange: function(evt) { | |
this.setState({city: evt.target.value}); | |
}.bind(this) | |
}) |
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
Dir.glob("**/*.{rb,rake,erb}").each do |path| | |
content = File.read path | |
content.gsub! /\r\n?/, "\n" | |
content.gsub! /[ \t]+$/, "" | |
content.gsub! /^\t+/, " " | |
File.write path, content | |
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
upstream codingstyleguide_upstream { | |
server unix:///home/deploy/sites/codingstyleguide/production/shared/tmp/sockets/puma.sock; | |
} | |
server { | |
listen 80; | |
server_name codingstyleguide-assets.xinminlabs.com; | |
access_log /var/log/nginx/codingstyleguide-asset.log; | |
error_log /var/log/nginx/codingstyleguide-error.log; | |
root /home/deploy/sites/codingstyleguide/production/current/public; |
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 'csv' | |
module Exporter | |
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ] | |
DESTINATION_FOLDER = "tmp/" | |
def self.included(klass) | |
klass.extend ClassLevelMethods | |
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
require 'csv' | |
module Exporter | |
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ] | |
DESTINATION_FOLDER = "tmp/" | |
def self.included(klass) | |
klass.extend ClassLevelMethods | |
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
#!/usr/bin/env ruby | |
pid = `ps | grep script/serve[r] | awk '{ print $1 }'`.chomp | |
puts "Server PID: #{pid}" | |
url = ARGV.last | |
puts "URL: #{url}" | |
puts "Hit enter to go." | |
$stdin.gets |
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
# To 2collegebums: This query generate a only one sql with left outer join, | |
# SELECT "comments"."id" AS t0_r0, "comments"."name" AS t0_r1, "comments"."post_id" AS t0_r2, "comments"."author_id" AS t0_r3, "base_users"."id" AS t1_r0, "base_users"."name" AS t1_r1, "base_users"."type" AS t1_r2, "posts"."id" AS t2_r0, "posts"."name" AS t2_r1, "posts"."category_id" AS t2_r2, "posts"."writer_id" AS t2_r3, "writers_posts"."id" AS t3_r0, "writers_posts"."name" AS t3_r1, "writers_posts"."type" AS t3_r2 FROM "comments" LEFT OUTER JOIN "base_users" ON "base_users".id = "comments".author_id LEFT OUTER JOIN "posts" ON "posts".id = "comments".post_id LEFT OUTER JOIN "base_users" writers_posts ON "writers_posts".id = "posts".writer_id AND ("writers_posts"."type" = 'Writer' ) WHERE (base_users.id = 1) | |
# so I think the test is not correct. | |
# | |
# this happens because it doesn't create an object association from post to writer | |
# by diving into the hash and creating those object associations | |
it "should detect preload of post => wr |
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
>> variable = ['key', 'value'] | |
>> key, value = *variable | |
>> key | |
=> "key" | |
>> value | |
=> "value" |
OlderNewer