Skip to content

Instantly share code, notes, and snippets.

View d1rtym0nk3y's full-sized avatar

Chris Blackwell d1rtym0nk3y

View GitHub Profile
component {
env = createObject("java", "java.lang.System").getenv();
this.name = "heroku-demo-app";
this.sessionManagement = true;
this.datasources.default = {
class: env.get("DB_DRIVER")
,connectionString: env.get("DB_URL")
private static long getCode(byte[] secret, long timeIndex)
throws NoSuchAlgorithmException, InvalidKeyException {
SecretKeySpec signKey = new SecretKeySpec(secret, "HmacSHA1");
ByteBuffer buffer = ByteBuffer.allocate(8);
buffer.putLong(timeIndex);
byte[] timeBytes = buffer.array();
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(signKey);
byte[] hash = mac.doFinal(timeBytes);
int offset = hash[19] & 0xf;
@d1rtym0nk3y
d1rtym0nk3y / coldspring.xml
Created January 22, 2013 12:12
coldspring 2 util:map bug on Railo
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.coldspringframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.coldspringframework.org/schema/util"
xsi:schemaLocation="http://www.coldspringframework.org/schema/beans http://coldspringframework.org/schema/coldspring-beans-2.0.xsd
http://www.coldspringframework.org/schema/util http://coldspringframework.org/schema/coldspring-util-2.0.xsd">
<util:map id="mapBean">
<entry key="keya" value="key a value"/>
<entry key="keyb" value="key b value"/>
<!---
example of using DirectoryTestSuite to run mxunit tests
assumes your tests are located at /tests/unit, or there is a mapping to that location
and that tests are organised into modules under this directory
--->
<cfif not structkeyexists(url, "module")>
<cfdirectory action="list" directory="#expandPath('.')#" name="dir" >
<cfoutput>
@d1rtym0nk3y
d1rtym0nk3y / Ant.sublime-build
Created February 7, 2012 14:16
SublimeText2 Ant build config
// save this as /Users/%user%/AppData/Roaming/Sublime Text 2/Packages/User/Ant.sublime-build
// on windows, or somewhere else on mac/linux
// make sure its "ant.bat" or it will moan about file not found
{
"cmd": ["ant.bat", "-f", "build.xml", "-DBUILD_HOST=local", "main"],
"working_dir": "$project_path"
}
if (typeof console != "object") { console = {log: function(){} } };