This file contains hidden or 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
defmodule Rumbl.Repo.Migrations.CreateVideo do | |
use Ecto.Migration | |
def change do | |
create table(:videos) do | |
add :url, :string | |
add :title, :string | |
add :description, :text | |
add :user_id, references(:users, on_delete: :nothing) |
This file contains hidden or 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
command! -range=% RubyNewHashNotation silent execute <line1>.','.<line2>.'s/:\(\w\+\)\s*=>\s*/\1: /g' |
This file contains hidden or 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
def enable_pry | |
ENV['DISABLE_PRY'] = nil | |
end | |
def disable_pry | |
ENV['DISABLE_PRY'] = 'true' | |
end |
This file contains hidden or 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
#!/bin/bash | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
This file contains hidden or 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
" Convert slashes to backslashes for Windows. | |
if has('win32') | |
nmap ,cs :let @*=substitute(expand("%"), "/", "\\", "g")<CR> | |
nmap ,cl :let @*=substitute(expand("%:p"), "/", "\\", "g")<CR> | |
" This will copy the path in 8.3 short format, for DOS and Windows 9x | |
nmap ,c8 :let @*=substitute(expand("%:p:8"), "/", "\\", "g")<CR> | |
else | |
nmap ,cs :let @*=expand("%")<CR> | |
nmap ,cl :let @*=expand("%:p")<CR> |
This file contains hidden or 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
# busca as chaves de um processo específico | |
Resque.redis.keys('*.DailyReportCachedProcessor') | |
# => ["concurrent.count.DailyReportCachedProcessor", "concurrent.queue_availability.DailyReportCachedProcessor", "concurrent.queue.high.DailyReportCachedProcessor"] | |
# verifique quantos jobs dessse processo estao rodando no resque | |
# utilize a chave concurrent.count.* para setar | |
Resque.redis.set('concurrent.count.DailyReportCachedProcessor', 8) | |
# limpar a lista |
This file contains hidden or 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
# config/initializers/forms.rb | |
Rails.application.config.to_prepare do | |
path = Rails.root + "app/forms" | |
ActiveSupport::Dependencies.autoload_paths -= [path.to_s] | |
reloader = ActiveSupport::FileUpdateChecker.new [], path.to_s => [:rb] do | |
ActiveSupport::DescendantsTracker.clear | |
ActiveSupport::Dependencies.clear | |
Dir[path + "**/*.rb"].each do |file| | |
ActiveSupport.require_or_load file | |
end |
This file contains hidden or 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
killRailsCScreen() { | |
screen_id=`screen -ls | grep $1 | cut -d'.' -f1 | awk '{print $1}'` | |
if [ ! -z "$screen_id" -a "$screen_id" != " " ]; then | |
rails_id=`ps elax | grep $screen_id | grep '[r]ails c' | awk '{print $3}'` | |
if [ ! -z "$rails_id" -a "$rails_id" != " " ]; then | |
`kill -9 $rails_id` | |
return 0 | |
else |
This file contains hidden or 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
function _rake_cache_path() { | |
# If in a Rails app, put the cache in the cache dir | |
# so version control ignores it | |
if [ -e 'tmp/cache' ]; then | |
prefix='tmp/cache/' | |
fi | |
echo "${prefix}.rake_t_cache" | |
} | |
function rake_cache_store() { |
This file contains hidden or 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
# Reference | |
# http://stackoverflow.com/questions/10274974/how-can-i-delete-specific-jobs-from-resque-queue-without-clearing-the-whole-queu | |
# Removes a job from a queue. Expects a string queue name, a | |
# string class name, and, optionally, args. | |
# | |
# Returns the number of jobs destroyed. | |
# | |
# If no args are provided, it will remove all jobs of the class | |
# provided. | |
# |