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" | |
} |
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
# Store Credit | |
# | |
# SMALL solution | |
data = File.read(ARGV[0] || 'in.txt').split | |
def pluck(data) | |
data.shift.to_i | |
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
# Reverse words | |
# Small and Large solution | |
# | |
data = File.read(ARGV[0] || 'in.txt').split("\n") | |
def pluck(data) | |
data.shift.to_i | |
end | |
times = pluck(data) |
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
# code/something.rb | |
class Something | |
def nothing | |
p caller | |
end | |
end | |
Something.new.nothing | |
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
run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["Hello World"]] } |
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
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'openssl' | |
content = ARGF.read | |
def create_vuash(message) | |
url = "https://vua.sh" | |
uri = URI(url) |
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
sudo apt-get update | |
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
source ~/.bashrc |
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 |
OlderNewer