This file contains hidden or 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
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
source ~/perl5/perlbrew/etc/bashrc | |
export TERM="xterm-256color" | |
PS1='[\u@\h \W$(__docker_machine_ps1)]\$ ' | |
[ -n "$PS1" ] | |
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH" | |
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/X11/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/bin/mysql:${PATH}" | |
export PATH=/usr/local/bin:/usr/local/sbin:$PATH |
This file contains hidden or 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
CREATE AGGREGATE vector_sum ( | |
sfunc = AXH_Vector_Sum, | |
basetype = int[], | |
stype = int[], | |
initcond = '{0}' | |
); | |
DROP FUNCTION IF EXISTS AXH_Vector_Sum(int[], int[]); | |
CREATE OR REPLACE FUNCTION AXH_Vector_Sum(int[], int[]) | |
RETURNS int[] AS $$ |
This file contains hidden or 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
CREATE AGGREGATE vector_sum ( | |
sfunc = AXH_Vector_Sum, | |
basetype = int[], | |
stype = int[], | |
initcond = '{0}' | |
); | |
DROP FUNCTION IF EXISTS AXH_Vector_Sum(int[], int[]); | |
CREATE OR REPLACE FUNCTION AXH_Vector_Sum(int[], int[]) | |
RETURNS int[] AS $$ |
This file contains hidden or 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
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
This file contains hidden or 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
class Dog | |
attr_writer :name | |
def initialize(name) | |
@name = name | |
end | |
def bark | |
puts "patrick" | |
end |
This file contains hidden or 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
# == Schema Information | |
# | |
# Table name: projects | |
# | |
# id :integer not null, primary key | |
# site_url :string | |
# scrape_date :date | |
# scrape_page :integer | |
# project_url :string | |
# project_id :string |
This file contains hidden or 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 "pry" | |
### REPL EXAMPLE | |
# | |
# ARGV array holds any additional parameters when the program is run | |
# | |
# STDIN.gets.chomp - waits for the user to input on the terminal | |
# | |
# |
This file contains hidden or 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
class SomeModel | |
include Mongoid::Document | |
field :date, :type => Date | |
validates_presence_of :date | |
def date=(value) | |
begin | |
date_parsed = value.to_date | |
write_attribute :date, date_parsed |
This file contains hidden or 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 :port, XXXX | |
server "XX.XXX.XXX.XX", :web, :app, :db, primary: true | |
set :application, "XXXXXXX" | |
set :user, "XXXXXXX" | |
set :deploy_to, "/home/#{user}/apps/#{application}" | |
set :deploy_via, :remote_cache | |
set :use_sudo, false | |
set :scm, "git" |
This file contains hidden or 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] pry(#<Activity>)> activity | |
=> #<Activity _id: 512e3ef99a4b7cecef000005, created_at: 2013-02-27 17:14:33 UTC, updated_at: 2013-02-27 17:14:33 UTC, slug: {"en"=>"activity2", "id"=>"activity2"}, search_slug: {"en"=>""}, category_ids: ["512e3ef99a4b7cecef000006"], name: {"en"=>"activity2"}, position: nil, icon: nil> | |
[2] pry(#<Activity>)> activity.categories | |
=> [#<Category _id: 512e3ef99a4b7cecef000006, created_at: 2013-02-27 17:14:33 UTC, updated_at: 2013-02-27 17:14:33 UTC, slug: {"en"=>"category3", "id"=>"category3"}, search_slug: {"en"=>"category3", "id"=>"category3"}, parent_id: nil, activity_ids: ["512e3ef99a4b7cecef000005"], level: 0, name: {"en"=>"category3"}, description: nil, group: nil, classification: "Category", position: 1>] | |
[3] pry(#<Activity>)> category1 | |
=> #<Category _id: 512e3ef99a4b7cecef000006, created_at: 2013-02-27 17:14:33 UTC, updated_at: 2013-02-27 17:14:33 UTC, slug: {"en"=>"category3", "id"=>"category3"}, search_slug: {"en"=>"category3", "id"=>"category3"}, parent_id: nil, activity_i |
NewerOlder