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 'net/ssh' | |
desc "Deploy site to production" | |
task :deploy => :environment do | |
host = 'yourhost.com' | |
user = 'username' | |
options = {:keys => '~/.ssh/keys/yourserver.pem'} | |
remote_path = '/path/to/rails_app' | |
commands = [ |
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
#Maybe my feature branch existed for a very long time, and I had to merge several branches into my feature branch to keep it up to date while I work. History is convoluted. It’s easiest to grab the raw diff create a clean branch. | |
git checkout master | |
git checkout -b cleaned_up_branch | |
git merge --squash private_feature_branch | |
git reset | |
#I now have a working directory full of my changes and none of the baggage from the previous branch. Now I manually add and commit my changes. |
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
AfterStep('@pause') do | |
print "Press Return to continue..." | |
STDIN.getc | |
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
export CONFIGURE_ARGS="with-sqlite3-include=/usr/local/include" && gem install sqlite3-ruby |
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
# https://gist.github.com/1214052 | |
require 'sinatra/base' | |
class ResqueWeb < Sinatra::Base | |
require 'resque/server' | |
use Rack::ShowExceptions | |
if CFG[:user].present? and CFG[:password].present? | |
Resque::Server.use Rack::Auth::Basic do |user, password| | |
user == CFG[:user] && password == CFG[:password] |
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
#Navigating | |
visit('/projects') | |
visit(post_comments_path(post)) | |
#Clicking links and buttons | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
(Issue.all(:conditions=>{:author_id => 45}).map(&:id) + Watcher.all(:conditions=>{:watchable_type => "Issue", :user_id => 45 }).map(&:watchable_id)).uniq.map{|i| Issue.find(i) }.select{|it| ["Новый", "Разработка", "Тестирование", "Проектирование", "Оценка результатов", "На перенос", "Перенесено", "К разработке"].include?(it.status.name) }.sort_by{|it| it.id }.each{|it| puts [it.id, it.tracker.name.inspect, it.status.name.inspect, it.priority, it.subject.inspect, it.author.name.inspect, (it.assigned_to.try(:name) || "").inspect, it.start_date, it.due_date, it.done_ratio, it.custom_field_values.select{|f| f.custom_field_id == 22 }.map(&:value).join(':').inspect].join(', ') }.size |
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
" An example for a vimrc file. | |
" | |
" Maintainer: Bram Moolenaar <Bram@vim.org> | |
" Last change: 2008 Jul 02 | |
" | |
" To use it, copy it to | |
" for Unix and OS/2: ~/.vimrc | |
" for Amiga: s:.vimrc | |
" for MS-DOS and Win32: $VIM\_vimrc | |
" for OpenVMS: sys$login:.vimrc |
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 'rubygems' | |
require 'xmpp4r/client' | |
include Jabber | |
server, login, password = "qip.ru", "my_login", "my_password" | |
to, subject, body = "someone@qip.ru", "XMPP4R test", "Hi, this is my first try from XMPP4R!!!" | |
Jabber::debug = true | |
jid=JID::new "#{login}@#{server}" |
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
{1=>2, 3=>4}.select{|a, b| [1].include? a }.inject({}){|r, v| r.merge(v[0] => v[1]) } |
OlderNewer