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
# Autotest for cakephp | |
# Adapted for linux-users by jonathan | |
# jonathan.duarte@rocketmail.com | tunecookies.tumblr.com | |
# Original article: http://www.amitsamtani.com/2010/05/09/cakephp-autotest-using-watchr/ | |
#mude para o caminho da sua aplicação | |
$cake = "php /var/www/MINHA_APPLICACAO/cake/console/cake.php" | |
watch('app/(models|controllers)/(.*).php') { |m| test_changed_model_or_controller(m[0]) } | |
watch('app/tests/cases/(models|controllers)/(.*).test.php') { |m| test_changed_test_case(m[0]) } |
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 'parslet' | |
require 'pp' | |
class Mini < Parslet::Parser | |
rule(:lparen) { str('(') >> space? } | |
rule(:rparen) { str(')') >> space? } | |
rule(:comma) { str(',') >> space? } | |
rule(:space) { match('\s').repeat(1) } | |
rule(:space?) { space.maybe } |
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 'origami' | |
input = "sample.pdf" | |
mypdf = Origami::PDF.read input | |
#load certificate file | |
certificate_raw = File.read "server.crt" | |
certificate = OpenSSL::X509::Certificate.new certificate_raw | |
#load key file |
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
# Installing old version of gem libv8 and therubyracer on mavericks | |
# Versions: | |
# libv8: 3.11.8.17 | |
# therubyracer: 0.11.4 | |
# | |
# Ref: http://www.motivatedcompany.com/post/65060531778/using-libv8-3-11-on-os-x-10-9-mavericks | |
git clone https://github.com/cowboyd/libv8.git | |
cd libv8 | |
git checkout 3.11 |
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
# Cleanup old local branchs | |
git remote prune origin | awk -F "/" '{ print $2 }' | tail -n +3 | xargs git branch -d |
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
# Install pg on mavericks | |
# Using Postgres app | |
export PATH="~/bin:/usr/local/bin:/usr/local/sbin:/Applications/Postgres93.app/Contents/MacOS/bin:$PATH" | |
gem install pg -v='0.14.0' | |
# Import pg dump to rails app | |
rake db:create:all | |
pg_restore -d app_development file.dump |
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
# app/controllers/sessions_controller.rb | |
class SessionsController < ApplicationController | |
def create | |
authenticate! | |
render :json => {:status => "200", :message => "You have successfully logged in"} | |
end | |
private | |
def warden | |
request.env['warden'] |
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
# Reference: http://ridingtheclutch.com/post/71345006944/how-to-add-directories-to-rake-stats | |
task :stats => "omakase:stats" | |
namespace :omakase do | |
task :stats do | |
require 'rails/code_statistics' | |
::STATS_DIRECTORIES << ["Services", "app/services"] | |
::STATS_DIRECTORIES << ["Services Tests", "test/services"] | |
CodeStatistics::TEST_TYPES << 'Services Tests' |
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
# Enhance rails test with lib directory | |
# | |
# http://www.seanbehan.com/how-to-add-additional-sub-directories-to-the-default-rails-testunit-file-structure | |
namespace :test do | |
Rake::TestTask.new(:lib) do |t| | |
t.libs << "test" | |
t.pattern = 'test/lib/**/*_test.rb' | |
t.verbose = true | |
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 'bundler/capistrano' | |
set :application, "net" | |
set :repository, "git@githost.com:net.git" | |
set :scm, :git | |
set :default_environment, { | |
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" | |
} |
OlderNewer