🧘♂️
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
# lib/omniauth-adwords-oauth2.rb | |
require "omniauth-google-oauth2" | |
class AdwordsOauth2 < OmniAuth::Strategies::GoogleOauth2 | |
option :name, 'adwords_oauth2' | |
end | |
# config/initializers/omniauth.rb | |
require "omniauth-adwords-oauth2" |
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
# Flatten a transparent image with a white background: | |
convert -flatten img1.png img1-white.png | |
# Make an image transparent | |
convert -transparent '#FFFFFF' nontransparent.gif transparent.png | |
# convert an image into tiles | |
convert -size 3200x3200 tile:single_tile.png final.png | |
# making a montage from a collection of images |
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 "dim" | |
AppContainer = Dim::Container.new | |
AppContainer.register(:env) { ENV['ADWORK_ENV'] || "development" } | |
AppContainer.register(:production?) { |c| c.env == 'production' } | |
AppContainer.register(:development?) { |c| c.env == 'development' } | |
AppContainer.register(:test?) { |c| c.env == 'test' } | |
AppContainer.register(:root) { File.expand_path(File.dirname(__FILE__)+"/../..") } | |
AppContainer.register(:logger) do |c| |
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
# Gemfile | |
gem "puma" | |
# Procfile | |
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb | |
# add to config block config/environments/production.rb | |
config.threadsafe! | |
# get rid of NewRelic after_fork code, if you were doing 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
namespace :assets do | |
task :check do | |
root_dir = File.join(File.dirname(__FILE__),"..","..") | |
assets_last_modified_at = Dir["#{root_dir}/app/assets/**/**"].map { |p| File.mtime(p) }.sort.last | |
assets_last_compiled_at = Dir["#{root_dir}/public/assets/**/**"].map { |p| File.mtime(p) }.sort.last | |
if assets_last_modified_at > assets_last_compiled_at | |
fail "Assets need to precompiled; last asset modified at #{assets_last_modified_at}" | |
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
# I learned this from @bkemper, very useful to show what's in a commit about to be pushed to the remote repo | |
# and what's in the commits that are about to be pulled from the remote repo | |
[alias] | |
in = "!f() { [[ -z \"$1\" ]] && B='master' || B=\"$1\"; git log $B..origin/$B; }; f" | |
out = "!f() { [[ -z \"$1\" ]] && B='master' || B=\"$1\"; git log origin/$B..$B; }; f" |
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
Alive 10 | |
# http://lvh.me | |
ListenHTTP | |
Address 127.0.0.1 | |
Port 80 | |
Service | |
BackEnd | |
Address 127.0.0.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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.staq.pound</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>sudo</string> | |
<string>/usr/local/sbin/pound</string> |
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
alias a='ack' | |
alias a?='alias | grep -i' | |
alias adx='rake db:drop && rake db:create && heroku pg:transfer --from black --to postgres://postgres@localhost/staq_development --confirm staqweb --app staqweb && rails r "User.all.each { |u| u.update_attribute(:password,%q(password)) }" && rake db:test:prepare' | |
alias b='bundle' | |
alias bb='bundle install --binstubs=.bundle/bin --path=.bundle/gems && bundle package --all && reload ; sd' | |
alias bc='bin/console' | |
alias be='bundle exec' | |
alias bea='bundle exec annotate' | |
alias bu='bundle update' | |
alias bus='bundle update staq_extraction' |
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
namespace :deploy do | |
task :default => [:production] | |
desc "check if git is clean" | |
task :check => "assets:check" do | |
unless system("git diff --exit-code") | |
puts "Git not clean. Aborting." | |
`growlnotify -m 'deployment failed'; say 'deployment failed'` | |
abort | |
end |