Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
@orangexception
orangexception / gist:3277875
Created August 6, 2012 19:40
CTXNumberFormat
function CTXNumberFormat( dNumber ) {
dNumber= DecimalFormat( dNumber );
dNumber= dNumber.ReplaceAll( "(\.0+|\.(\d)0)$" , ".$2" );
dNumber= dNumber.ReplaceAll( "," , "" );
dNumber= dNumber.ReplaceAll( "\.$" , "" );
dNumber= dNumber.ReplaceAll( "^0+" , "" );
return dNumber;
}
@orangexception
orangexception / gist:1301150
Created October 20, 2011 13:33
Minify JavaScript Regular Expression

Notice

Do not run this against minified JavaScript packages. The minified packages often rely on line returns to execute correctly.

This regular expression was designed to minify simple JavaScript.

Regular Expression

(?s)[\t\r\n]|[ ][ ]+|/\*.*?\*/*

I put spaces in square brackets as a reminder that they exist. Spaces can be important. For example, $( "#foo #bar" ) should not become $("#foo#bar"). However, we do want to remove spaces if they are used for indentation.

@orangexception
orangexception / gist:1292778
Created October 17, 2011 14:53
Minify CSS Regular Expression

Regular Expression

(?s)\s|/\*.*?\*/

Usage in ColdFusion

I've tested with ColdFusion 8 and Railo 3.3.

sCSSContent= sCCSContent.ReplaceAll( "(?s)\s|/\*.*?\*/" , "" );

Test Cases

@orangexception
orangexception / gist:1284209
Created October 13, 2011 13:25
storeStructIntoSession
<cffunction name= "storeStructIntoSession"
output= "false"
hint= "I store a form into the session scope">
<cfargument name= "stTarget"
required= "true"
hint= "I am the target struct for storage." />
<cfargument name= "sSessionKey"
required= "false"
@webRat
webRat / git_commands
Created June 23, 2011 02:38
9 Common Git Commands
git init - navigate to the appropriate directory and just type that.
git add . - adds everything in that path
git commit -m 'stuff' - Commits with the message 'stuff'
git branch - views branches
git checkout -b <new branch> - Creates & switches to new branch
git checkout <branch> - switches to branch
git merge <branch> - merges that branch to the existing branch that you're already in.
git branch -d <branch> - deletes branch
git push - This assumes you already have a remote setup (like github)