echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >
/etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc
| sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
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
# Gather your inputs, cast as string and strip whitespace | |
name = str(event.source.parent.getComponent('nameFilter').text).strip() | |
farm = str(event.source.parent.getComponent('farmFilter').text).strip() | |
item = str(event.source.parent.getComponent('itemFilter').text).strip() | |
cluster = str(event.source.parent.getComponent('clusterFilter').text).strip() | |
start_date = event.source.parent.getComponent('startDate').text | |
end_date = event.source.parent.getComponent('endDate').text | |
# Empty array to contain conditions | |
conditions = [] |
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
# Get all alarms | |
alarms = system.alarm.queryStatus() | |
note = "Acked by Zeus" | |
alm_ids = [] | |
# Add alarm id cast as string to alm_ids list | |
for row in alarms: | |
alm_ids.append(str(row.getId())) | |
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
function RandomColorScheme() | |
let mycolors = split(globpath(&rtp,"**/colors/*.vim"),"\n") | |
exe 'so ' . mycolors[localtime() % len(mycolors)] | |
unlet mycolors | |
endfunction | |
call RandomColorScheme() | |
:command NewColor call RandomColorScheme() |
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
class InvoicesController < ApplicationController | |
def generate | |
@accounts = Account.all | |
@invoices = [] | |
@accounts.each do |a| | |
inv = Invoice.generate_account_billing(a, params[:invoice]) | |
@invoices << inv | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
payments.sum(&:price) | |
payments.inject(0) { |sum, p| sum + p.price } | |
invoices.map(&:total_due).reduce(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
class Invoice < ActiveRecord::Base | |
belongs_to :account | |
has_many :charges | |
end | |
class Charge < ActiveRecord::Base | |
belongs_to :invoice | |
belongs_to :chargeable, :polymorphic => true | |
delegate :total, to: :chargeable, prefix: true |
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
class Client < ActiveRecord::Base | |
has_many :accounts | |
end | |
class Account < ActiveRecord::Base | |
belongs_to :client | |
has_many :invoices | |
has_many :payments | |
end |
OlderNewer