Command: heroku pg:backups capture -a [app_name]
Command: curl -o latest.dump `heroku pg:backups public-url -a [app_name]`
def get_pairs(arr, sum) | |
len = arr.length | |
seen = Array.new(len, false) | |
result = [] | |
for i in 0..len-1 | |
for j in i+1..len-1 | |
if arr[i] + arr[j] == sum && !seen[j] && !seen[i] | |
seen[i], seen[j] = true, true | |
result << [arr[i], arr[j]] |
package hash_table; | |
import java.util.ArrayList; | |
public class SumOfPairs { | |
public static void getPairs(int[] arr, int sum) { | |
int length = arr.length; | |
boolean[] seen = new boolean[length]; | |
ArrayList<ArrayList<Integer>> list = new ArrayList<>(); | |
ArrayList<Integer> temp; |
#include <iostream> | |
#include <iterator> | |
#include <functional> | |
#include <algorithm> | |
#include <queue> | |
#include <vector> | |
#include <set> | |
#include <sstream> | |
#include <string> |
I hereby claim:
To claim this, I am signing this object:
class ActiveRecord::Base | |
def self.has_statuses(*status_names) | |
validates :status, | |
:presence => true, | |
:inclusion => { :in => status_names } | |
# Status Finders | |
status_names.each do |status_name| | |
scope "all_#{status_name}", where(:status => status_name) | |
end |
Database tables: | |
Users { | |
id | |
name | |
} | |
Roles { | |
id | |
name |
tyler@tyler-durden:~/EDGEAuditor-master$ rake db:migrate | |
/home/tyler/.rvm/gems/ruby-2.3.0@rails4/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now | |
/home/tyler/.rvm/gems/ruby-2.3.0@rails4/gems/logglier-0.2.13/lib/logglier/client/http/sync.rb:11: warning: constant Logglier::Client::HTTP::NetHTTPProxy::TimeoutError is deprecated | |
rake aborted! | |
Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x005645877ac998 @paths=["/home/tyler/EDGEAuditor-master/config/routes.rb", "/home/tyler/.rvm/gems/ruby-2.3.0@rails4/gems/ckeditor-4.2.3/config/routes.rb"], @route_sets=[#<ActionDispatch::Routing::RouteSet:0x00564589aa08c8>, #<ActionDispatch::Routing::RouteSet:0x0056458cac2f60>, #<ActionDispatch::Routing::RouteSet:0x005645877a7538>]> | |
/home/tyler/.rvm/gems/ruby-2.3.0@rails4/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_upd |
str = '123456789012345678909999991234569999' | |
h = {} | |
str.split("").each do |i| | |
h[i] = 0 if h[i].nil? | |
h[i] += 1 | |
end | |
h.each do |key, value| | |
puts "#{key} #{"*"*value}" |
after "deploy:symlink", "deploy:restart_workers" | |
after "deploy:restart_workers", "deploy:restart_scheduler" | |
## | |
# Rake helper task. | |
# http://pastie.org/255489 | |
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
def run_remote_rake(rake_cmd) | |
rake_args = ENV['RAKE_ARGS'].to_s.split(',') |