Skip to content

Instantly share code, notes, and snippets.

View bittersweetryan's full-sized avatar

Ryan Anklam bittersweetryan

View GitHub Profile
@bittersweetryan
bittersweetryan / gist:1147293
Created August 15, 2011 17:44
old, messy code
$(document).ready(function(){
$("#saveContract").validate({
messages:{
highwayName:{
required: "Enter a highway name."
}
}
});
@bittersweetryan
bittersweetryan / gist:1147295
Created August 15, 2011 17:44
cleaned up using literal pattern
var contractForm = {
init : function(){
this.validate();
this.mask();
this.showPay();
this.changePartyID();
this.initValidator();
this.validateCBA();
this.setComboboxes();
@bittersweetryan
bittersweetryan / gist:1166407
Created August 23, 2011 20:24
Today's Code Fail
public List findByProjectContractDetailId(Long contractDetailID) {
logger.info("finding all ContractTaskDetail instances");
try {
String queryString = "from ContractTaskDetail";
Query queryObject = getSession().createQuery(queryString);
List contractTaskDetailList = queryObject.list();
//um...queryObject.list returns nearly 1000000 rows hows about we write a freaking
//WHERE clause
for(Iterator it=queryObject.list().iterator(); it.hasNext(); )
@bittersweetryan
bittersweetryan / gist:1222121
Created September 16, 2011 13:22
Injecting Dynamic ColdFusion Into Your JavaScript
var myData = {
property1 : "",
property2 : "",
property3 : "",
method1 : function(element){
@bittersweetryan
bittersweetryan / gist:1244178
Created September 27, 2011 02:40
Class with instance variables and constructors
public class Car{
/* these are instance variables, they are defined outside of any function which means that any
function in the class can access them. Since they are private ONLY functions in the class
can access them. However note that the String is not set to anything, trying to access it
would throw an error.
*/
private String color;
private int doors;
@bittersweetryan
bittersweetryan / gist:1244995
Created September 27, 2011 12:57
Set Consolas In Sublime Text 2
{
"font_face": "consolas",
"font_size": 11
}
@bittersweetryan
bittersweetryan / gist:1298314
Created October 19, 2011 13:42
Run test suite in order
<cfscript>
testSuite = new mxunit.framework.TestSuite();
//i'd like to run the tests in this order
testSuite.addAll("Koans.AboutAsserts");
testSuite.addAll("Koans.AboutVariables");
testSuite.addAll("Koans.AboutArrays");
testSuite.addAll("Koans.AboutStructs");
testSuite.addAll("Koans.AboutFunctions");
testSuite.addAll("Koans.AboutComponents");
@bittersweetryan
bittersweetryan / gist:1301315
Created October 20, 2011 14:42
js code to review
var directPurchase = (function(window, document, undefined){
var directPurchaseModal = "",
directPurchaseForm = "",
isSetup = false;
function setupDirectPurchaseLink(){
$("#directPurchaseLink").live("click",function(e){
directPurchaseModal.dialog( "open" );
@bittersweetryan
bittersweetryan / scriptfunction.tmSnippet
Created October 21, 2011 12:31
Script Function Snippet for SublimeText 2
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>content</key>
<string>${1:${2:public} ${3:void} function $4($5)}${6:
${7:output=${8:false} }${9:hint="$10"}}{
$0
}</string>
<key>name</key>
<string>scriptFunction</string>
@bittersweetryan
bittersweetryan / gist:1620983
Created January 16, 2012 13:55
Blog Post - Ordered Test Decorator
<cfscript> //ignore, just here for syntax coloring
/**
* @mxunit:decorators mxunit.framework.decorators.OrderedTestDecorator
*/
component extends="mxunit.framework.TestCase"{
...
}
</cfscript>