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
# delete local branches | |
git branch --merged | grep -v develop | grep -v sandbox | grep -v master | xargs -n 1 git branch -d | |
# delete remote branches | |
git branch -r --merged | grep origin | grep -v develop | grep -v sandbox | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete |
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
# make sure your current ruby version is 2.3.0.preview1 or newer | |
gem install synvert -v 0.9.1 | |
synvert --sync | |
synvert -r ruby/new_safe_navigation_operator |
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
gem install synvert | |
synvert --sync | |
synvert -r ruby/new_hash_syntax $PROJECT_PATH | |
synvert -r ruby/new_lambda_syntax $PROJECT_PATH |
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 BottomlessHash < Hash | |
def initialize | |
super &-> h, k { h[k] = self.class.new } | |
end | |
def self.from_hash(hash) | |
new.merge(hash) | |
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
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
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
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
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
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 |