This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof console != "object") { console = {log: function(){} } }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// 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" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
sysenv = createObject("java", "java.lang.System").getenv(); | |
dbUri = createobject("java", "java.net.URI").init(env("DATABASE_URL")); | |
this.datasources.default = { | |
class:'org.gjt.mm.mysql.Driver' | |
,connectionString:'jdbc:mysql://#dbUri.getHost()##dbUri.getPath()#?#dburi.getQuery()#' | |
,username: listfirst(dbUri.getUserInfo(), ":") | |
,password: listlast(dbUri.getUserInfo(), ":") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfsetting requesttimeout="999999" enablecfoutputonly="true" /> | |
<cfscript> | |
progress("Importing data", 0); | |
recordcount = 100; | |
for(i=1; i<=recordcount; i++) { | |
// do something | |
sleep(250); | |
progress("Importing data", i, recordcount) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat ~/.ssh/id_rsa.pub | ssh root@server "(cat > tmp.pubkey ; mkdir -p .ssh ; touch .ssh/authorized_keys ; sed -i.bak -e '/$(awk '{print $NF}' ~/.ssh/id_rsa.pub)/d' .ssh/authorized_keys; cat tmp.pubkey >> .ssh/authorized_keys; rm tmp.pubkey)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Application.cfc | |
component extends="fw1" { | |
// omiting all the usualy fw1 stuff.. | |
function setupRequest() { | |
// this is just a wrapper around a singleton instance of the java class com.newrelic.api.agent.NewRelic | |
var nr = getBeanFactory().getBean("NewRelic"); | |
// setup newrelic to track the this request | |
nr.setTransactionName( nullValue(), "/#getFullyQualifiedAction()#"); | |
// track whatever custom values you need | |
nr.addCustomParameter( "session_id", session.sessionid ); |
OlderNewer