Skip to content

Instantly share code, notes, and snippets.

@nommy
nommy / sec apex
Created June 12, 2012 05:41
second apex
trigger HandleProductPriceChange on Merchandise__c (after update) {
// update invoice line items associated with open invoices
}
@nommy
nommy / firstapex
Created June 12, 2012 05:39
first apex
trigger HandleProductPriceChange on Merchandise__c (after update) {
}
@nommy
nommy / fuga
Created June 12, 2012 05:30
fuga apex
trigger HandleProductPriceChange on Merchandise__c (after update) {
// update invoice line items associated with open invoices
List<Line_Item__c> openLineItems =
[SELECT j.Unit_Price__c, j.Merchandise__r.Price__c
FROM Line_Item__c j
WHERE j.Invoice_Statement__r.Status__c = 'Negotiating'
AND j.Merchandise__r.id IN :Trigger.new
FOR UPDATE];
@nommy
nommy / hoge
Created June 11, 2012 09:00
hoge
IF(
ISNEW(),
Merchandise__r.Total_Inventory__c < Units_Sold__c ,
IF(
Units_Sold__c < PRIORVALUE(Units_Sold__c),
FALSE,
Merchandise__r.Total_Inventory__c < (Units_Sold__c - PRIORVALUE(Units_Sold__c))
)
)
@nommy
nommy / hello3.rb
Created June 1, 2012 01:39
Sinatra Prac3
require 'rubygems'
require 'sinatra'
get '/' do
erb %{
<p>What your name?</p>
<form action='/hello' method='POST'>
<input type='text' name='name'>
<input type='submit' value='submit'>
</form>
@nommy
nommy / hello2.rb
Created June 1, 2012 01:28
Sinatra prac2
require 'rubygems'
require 'sinatra'
get '/' do
erb %{
<p>What your name?</p>
<form action='/hello' method='POST'>
<input type='text' name='name'>
<input type='submit' value='submit'>
</form>
@nommy
nommy / sinatrahello.rb
Created May 31, 2012 12:04
Sinatra Hello,world
require 'rubygems'
require 'sinatra'
get '/' do
'Hello, world!'
end
@nommy
nommy / hello.rb
Created May 26, 2012 16:00
AOJ Problem Volume100-10005 - Print Many Hello Worl
for i in 1..1000
puts "Hello World"
end
@nommy
nommy / Small, Large, or Equal.rb
Created May 25, 2012 12:28
AOJ Problem Volume100-10003 - Small, Large, or Equal
x = gets.chomp
s = x.split(nil)
a = x.split[0].to_i
b = x.split[1].to_i
if a < b
puts "a < b"
elsif a > b
puts "a > b"
else a == a
@nommy
nommy / Rectangle.rb
Created May 23, 2012 04:45
AOJ Problem Volume100-10002 - Rectangle
x = gets.chomp
s = x.split(nil)
a = x.split[0].to_i
b = x.split[1].to_i
area = a * b
compass = a**2 + b**2
puts area.to_s + " " + compass.to_s