Skip to content

Instantly share code, notes, and snippets.

View ivanacostarubio's full-sized avatar
💭
⚡️accelerating

Ivan ivanacostarubio

💭
⚡️accelerating
View GitHub Profile

Media Temple Capistrano Deployment Recipe

With GitHub

See comments in the files for explanation. This works flawlessly for me on MediaTemple + Git(Hub).

NOTE: this assumes that the application name on the grid container and the application name in GitHub are the same.

To use:

On the Server

http://en.wikipedia.org/wiki/Levenshtein_distance
[root@linux-server test]# irb
irb(main):001:0>
Create a list of values contained in an array object:
myList = ['ruby','sql','ruby','bash','python','perl','java','sql']
=> ["ruby", "sql", "ruby", "bash", "python", "perl", "java", "sql"]
require 'rubygems'
require 'freshbooks'
FreshBooks::Base.establish_connection('name.freshbooks.com', 'secret')
invoices = FreshBooks::Invoice.list
begin
invoices.to_a
invoices.delete_if { |invoice| invoice.status == "paid" }
~/sinatra/cancuntravelnow(master) $ sudo gem update heroku
Updating installed gems
Nothing to update
~/sinatra/cancuntravelnow(master) $ gem list | grep heroku
heroku (1.3.0)
~/sinatra/cancuntravelnow(master) $ heroku create cancuntravelnow
This version of the heroku gem has been deprecated.
Please update it by running: gem update heroku
def create
remote = extract_option('--remote', 'heroku')
name = args.shift.downcase.strip rescue nil
name = heroku.create(name, {})
display "Created #{app_urls(name)}"
if remote || File.exists?(Dir.pwd + '/.git')
remote ||= 'heroku'
return if shell('git remote').split("\n").include?(remote)
shell "git remote add #{remote} git@#{heroku.host}:#{name}.git"
display "Git remote #{remote} added"
before_filter :should_have_job_hunter :except => [ :index ]
# call to action al aplicar para que llenen el trabajo perfecto
def should_have_job_hunter
@user = User.find_by_id(current_user.id, :include => :job_hunter)
if @user.job_hunter==nil
redirect_to "/job_requests/new"
end
end
# app.rb
require 'rubygems'
require 'sinatra'
require 'yaml'
require 'wufoo'
config = YAML::load(File.read('config/wufoo'))
<script type="text/javascript" charset="utf-8">
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "THE URL YOU WANT TO REDIRECT";
}
</script>
<form action="https://ws.thinkingphones.com/tpn-portlet/services/SimpleCallOriginationService/simplePlaceCall" method="post">
<p><label>wsUser</label><input type="text" name="wsUser" value="nate-ws-admin" id="wsUser"></p>
<p><label for="wspassword">wsPassword</label><input type="text" name="wsPassword" value="C@11C4ncun5xy" id="wsPassword"></p>
<p><label for="uid">uid</label><input type="text" name="uid" value="davar.nate" id="uid"></p>
<p><label for="number">number</label><input type="text" name="number" value="3057737020" id="number"></p>
<p><input type="submit" value="Continue &rarr;"></p>
</form>
// CANNED RESPONSES
$(document).ready(function() {
$('.opportunity').append('<div class="canned_responses"></div>');
$.getJSON("/canned_responses.json",
function(data){
$.each(data, function(i,item){
$('.canned_responses').after('<div class="canned_titles" value=' + item._id + '>' + item.title + '</div>');