Skip to content

Instantly share code, notes, and snippets.

@robjshaw
robjshaw / gist:4980676
Last active December 13, 2015 21:58 — forked from davidsirr/gist:4976499
# get homebrew http://mxcl.github.com/homebrew/
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# use homebrew to install rbenv and ruby-build
brew update
brew install rbenv
brew install ruby-build
# view available rubies
rbenv install --list
@robjshaw
robjshaw / gist:5002921
Last active June 4, 2021 22:29
paypal webcheckout with coldfusion
<!--- STEP 1 - ?event=shop-cart.cfm --->
<cfscript>
stDetails = structNew();
stDetails.cartTotal = 200.00;
stDetails.invoiceno = 3;
</cfscript>
<cfhttp url="https://api-3t.paypal.com/nvp" method="post">
<!--- auth --->
<cfhttpparam type="formfield" name="USER" value="#application.pp.username#" />
# create rails app - option allows you to write test suite in rspec instead of default
rails new demo_app --skip-test-unit
# production only gems located in gemfile (pg = postgres)
group :production do
gem 'pg', '0.12.2'
end
# dev and test env
group :development, :test do
@robjshaw
robjshaw / gist:5017372
Last active December 14, 2015 02:59
git basic
# create ssh key https://help.github.com/articles/generating-ssh-keys
# create repo https://github.com/new
git init
git add .
git commit -m "Initial commit"
git mv README.rdoc README.md
git commit -a -m "Improve the README"
#gem file config
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
end
group :test do
gem 'capybara', '1.1.2'
@robjshaw
robjshaw / gist:5026513
Last active December 14, 2015 04:09
mysql temp table example
DROP TEMPORARY TABLE IF EXISTS tempTable;
CREATE TEMPORARY TABLE tempTable (id INT, fkid INT, comment TEXT);
INSERT INTO tempTable SELECT id, fid, comment FROM table WHERE DATE(commentDate) = DATE_ADD(DATE(now()), INTERVAL -2 DAY);
SELECT * FROM tempComment WHERE comment like 'textstring%'
@robjshaw
robjshaw / mysql trigger example
Last active December 14, 2015 04:09
mysql trigger - action time: before / event: update
/* logging example */
BEGIN
IF new.status <> old.status
THEN
INSERT INTO pstatus_log(dtCreated, statusOld, statusNew, fkid)
VALUES (now(), old.status, new.status, new.fkid);
END IF;
END
@robjshaw
robjshaw / gist:5149483
Created March 13, 2013 04:57
cfquery monitoring on a batch without debugging enabled
<cfscript>
stQuery = structNew();
</cfscript>
<cfquery name="stQuery.a" datasource="#request.ds#">
SELECT *
FROM table1
</cfquery>
<cfquery name="stQuery.b" datasource="#request.ds#">
@robjshaw
robjshaw / gist:5209216
Created March 20, 2013 22:41
coldfusion dev environment virtualbox - ubuntu server 12.10
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server
sudo reboot
## shared folders
@robjshaw
robjshaw / gist:5219039
Last active December 15, 2015 06:49
keytool coldfusion built in webserver
keytool -genkey -dname "cn=127.0.0.1, ou=CF, o=robjshaw, L=Sydney, ST=NSW, C=AU" -keyalg rsa -keystore mykey
keytool -importkeystore -srckeystore mykey -destkeystore mykeyout.p12 -deststoretype PKCS12