Skip to content

Instantly share code, notes, and snippets.

@jasontruluck
jasontruluck / Users.java
Created Feb 18, 2014
Play! framework form validations
View Users.java
package controllers;
// Java
import java.util.*;
// Play
import play.*;
import play.mvc.*;
import play.libs.Json;
import play.data.validation.Constraints;
import play.data.Form;
import models.*;
@jasontruluck
jasontruluck / Excon Output
Created Jun 6, 2014
Output for Excon debugging
View Excon Output
excon.request
:body => #<File:/Users/jason/Projects/private/project/core/public/images/public/images/1402076353-18822-7607/item.png>
:chunk_size => 1048576
:ciphers => "HIGH:!SSLv2:!aNULL:!eNULL:!3DES"
:connect_timeout => 60
:debug_reponse => true
:debug_request => true
:debug_response => true
:expects => 200
:headers => {
View keybase.md

Keybase proof

I hereby claim:

  • I am jasontruluck on github.
  • I am jasontruluck (https://keybase.io/jasontruluck) on keybase.
  • I have a public key whose fingerprint is 0BD6 2B98 B591 8073 E882 5F22 1409 62B1 F109 E81C

To claim this, I am signing this object:

@jasontruluck
jasontruluck / string_to_array.rb
Created Jun 12, 2013
Benchmark 100,000 items converting string to array ruby
View string_to_array.rb
require "benchmark"
puts Benchmark.measure {
100000.times do
"[1,2,3,4]"[1..-2].split(",")
end
}
puts Benchmark.measure {
100000.times do
@jasontruluck
jasontruluck / jenkins-ci-install.sh
Last active Dec 19, 2015
Jenkins CI server install script. Read comments at top of script for details.
View jenkins-ci-install.sh
#!/bin/bash
## Please modify and use at your leisure!
## This script installs:
## -Jenkins CI
## -RVM
## -Ruby 1.9.3
## -Postgresql 9.2
## -Phantom JS 1.9.0
## -Redis 2.4.16
@jasontruluck
jasontruluck / benchmark.rb
Created Nov 30, 2013
Quick benchmark for .reject with rejected array initialization in loop and out of loop
View benchmark.rb
require "benchmark"
ITEMS = { :foo => "bar", :fizz => "buzz", :fazz => "bazz" }
REJECTED_ITEMS = [:foo, :fazz]
# Number of iterations
@n = 10
def with_constant
@n.times do
@jasontruluck
jasontruluck / app_and_db_server.sh
Last active May 26, 2020
Sets up a SINGLE linode with application and database configuration.
View app_and_db_server.sh
#!/bin/bash
## Please modify and use at your leisure!
## This script installs:
##
## -RVM
## -Ruby 1.9.3
## -Postgresql 9.2
## -Nginx
## -Postfix
You can’t perform that action at this time.