INSTALLATION
echo "gem 'array_to_proc', git: 'git://gist.github.com/bf95dedd5a2a6046ada7.git'" >> Gemfile
or
git clone [email protected]:/bf95dedd5a2a6046ada7.git
gem build array_to_proc.gemspec
gem install --local array_to_proc-0.0.1.gem
# ! dynamically generated image names exist | |
# ! watch nginx logs for image requests to find unused images | |
find ./app/assets/images/ -type f -exec basename {} \; | | |
while read line; do $(grep -r $line ./app/views/ >/dev/null) || | |
echo $line; done > ~/.Trash/res.txt |
ruby -e " | |
'`find ./app/views -name _*`' | |
.split | |
.map { |f| f.split('/').last[1..-1][/[^\.]+/] } | |
.each { |f| system( %Q(fgrep -rq #{f} ./app/views/) ) ? nil : p(f) } | |
" |
grep "^Started " api-310?.log | \ | |
egrep -o "\"/\w+/\w+[/\"]" | \ | |
sed -E "s/^\"|[\"\/]$//g" | \ | |
sort | \ | |
uniq > api_routes.txt | |
be rake routes > /tmp/api/rails_routes.txt | |
\grep -v -h -F -f api_routes.txt rails_routes.txt | grep api |
#!/bin/sh | |
# | |
# An example hook script to verify what is about to be committed. | |
# Called by "git commit" with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# To enable this hook, rename this file to "pre-commit". | |
if git rev-parse --verify HEAD >/dev/null 2>&1 |
# encoding: utf-8 | |
# Null-Object pattern. | |
# - has no state by definition and can be Singleton dp | |
# Prevent code from cluttered if condition checks to find that object is present and is not nil. | |
# Naught class also has a good examples of ruby conversion operators | |
class Georgian | |
def make_it_so(logger = nil) | |
# HAVING THIS PROBLEM: |
# USAGE IN RAILS APP | |
# config.middleware.insert_before(ActionDispatch::Static, TracePoint::Middleware) | |
# | |
class TracePoint | |
class Middleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
INSTALLATION
echo "gem 'array_to_proc', git: 'git://gist.github.com/bf95dedd5a2a6046ada7.git'" >> Gemfile
or
git clone [email protected]:/bf95dedd5a2a6046ada7.git
gem build array_to_proc.gemspec
gem install --local array_to_proc-0.0.1.gem
# | |
find lib/ -name "*.rb" | xargs grep -h --color -e ^class | cut -d ' ' -f 2 | sort | uniq | egrep -v "^Time" | egrep -v "^Hash" | egrep -v "^UserMailer" | while read k; do echo lib class: "$k"; grep -r -l -w -m 1 --color "$k" ./app ./config ./lib ./script --exclude-dir=*assets* | head -n 2 | wc -l | grep 1; done |
# | |
find app/models/ -name "*.rb" | xargs grep -h --color -e ^class | cut -d ' ' -f 2 | sort | uniq | while read k; do echo model class: "$k"; grep -r -l -w -m 1 --color "$k" ./app ./config ./lib ./script --exclude-dir=*assets* | head -n 2 | wc -l | grep 1; done |
#!/usr/bin/env bash | |
# Run unicorn in the foreground and customize how it runs. | |
# | |
# Usage: ./script/start_rails_fg.bash | |
# ./script/start_rails_fg.bash --help | |
# supports these env variables: UNICORN_PID | |
# UNICORN_LISTEN | |
# UNICORN_STDERR_PATH | |
# UNICORN_STDOUT_PATH |