Skip to content

Instantly share code, notes, and snippets.

View kreas's full-sized avatar
:shipit:
Heathen

Tim Warren kreas

:shipit:
Heathen
View GitHub Profile
events.each do |event|
params = event.parameters
attrs = {}
attrs[:name] = params["name"] unless event.name rescue nil
attrs[:weather_deg] = (params["weather_deg"].empty? ? nil : params["weather_deg"].to_i) unless event.weather_deg rescue nil
attrs[:priority_rate] = (params["priority_rate"].empty? ? nil : params["priority_rate"].to_i) unless event.priority_rate rescue 3
attrs[:rooms_on_peak] = (params["rooms_on_peak"].empty? ? nil : params["rooms_on_peak"].to_i) unless event.rooms_on_peak rescue nil
attrs[:sf_account_id] = params["sf_account_id"] unless event.sf_account_id rescue nil
attrs[:sf_contact_id] = params["sf_contact_id"] unless event.sf_contact_id rescue nil
@kreas
kreas / fields
Created February 17, 2016 16:05
rooms_on_peak : integer,
total_room_nights : integer,
preferredDestinations : ?,
preferred_destination_only: boolean,
meeting_space_required : boolean,
min_total_exhibit_size : integer,
min_ballroom_size : integer,
main_group_arrival_date : date,
main_group_departure_date : date,
mainGroupArrivalDepartureDates: ?,
trigger Opportunity on Opportunity (before insert, before update, after insert, after update) {
set<id> newEvents = new set<id>();
set<id> updateEvents = new set<id>();
set<string> changingFields = new set<string>{
'Primary_Contact__c',
'Lead_ID__c',
'AccountID',
'Name',
'StageName',
'Confirmation_Number__c',
@kreas
kreas / .vimrc
Created December 4, 2015 17:11
.vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - [email protected]
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@kreas
kreas / gist:bece522dc38754fea78d
Created September 10, 2015 03:03
optimize_route
class Route
API_KEY = 'XXXXXXXXXXXXXXXX'
ADDRESSES = [·
{:index=>0, :lat=>36.08290100097656, :lng=>-87.09459686279297, :site_id=>1532, :address=>"162 Luyben Hills Rd, Kingston Springs, TN, 37082"},
{:index=>1, :lat=>35.911598205566406, :lng=>-84.14720153808594, :site_id=>1517, :address=>"608 Lovell Rd., Knoxville, TN, 37932"},
{:index=>2, :lat=>41.52130126953125, :lng=>-83.46160125732422, :site_id=>1967, :address=>"3483 Libbey Rd., Perrysburg, OH, 43551"}
]
def self.addresses
Verifying I am +kreas on my passcard. https://onename.com/kreas
@kreas
kreas / update_tracking.rb
Last active December 17, 2015 02:12
update tracking information
data.map! { |d| d[2] = Date.strptime(d[2], "%m/%d/%Y"); d }
data.each { |d| Order.where(invoice_number: d[0]).first.update_attributes(status: 'completed', shipping_detail: { carrier: 'USPS', tracking_number: d[1], ship_date: d[2] } ) rescue nil }

Javascript Assessment

To complete this assessment, create a Github Gist for each tasks below. Once completed, please email a link for each Gist to [email protected].

This assessment was designed to help evaluate your knowledge of the core Javascript language. Please do not use any libraries such as jQuery of Underscore.

  1. Create a function called fizzBuzz that takes an integer (n). The function should loop over each number between 1 and n and prints "Fizz" if the number is divisible by 3, "Buzz" if the number is divisible by 5, "FizzBuzz" if the number is divisible by 3 and 5, and if the number is not divisible 3 or 5, it should print the number.

  2. Create a function called flipCoin that takes no parameters and randomly returns the string 'heads' or 'tails'. Create a second function called flipCoinResults that takes an integer n and runs flipCoin n times. flipCoinResults should return a string that represents the distribution of heads and tails for a gi

#!/bin/bash
echo Provisioning Evergreen...
echo - Installing dependencies
sudo apt-get update -y -qq > /dev/null
sudo apt-get install curl -y -qq > /dev/null
echo - Installing other software
sudo apt-get -y install libxslt-dev libxml2-dev
sudo apt-get -y install nodejs
@kreas
kreas / rails.sh
Last active August 29, 2015 14:16
#!/bin/bash
echo Provisioning Evergreen...
echo - Installing dependencies
sudo apt-get update -y -qq > /dev/null
sudo apt-get install curl -y -qq > /dev/null
echo - Installing other software
sudo apt-get -y install libxslt-dev libxml2-dev
sudo apt-get -y install nodejs