Skip to content

Instantly share code, notes, and snippets.

<cfparam name="url.chr" type="numeric" default="40" />
<cfparam name="url.useCustomFunction" type="boolean" default="false" />
<cfsilent>
<cfset myStruct = StructNew() />
<cfset myStruct["myString"] = ":DEC:[#url.chr#] - :CHR:[#chr(url.chr)#]." />
<cfif url.useCustomFunction>
<cfset myJSON = SafeSerializeJSON(myStruct) />
<cfelse>
<cfset myJSON = SerializeJSON(myStruct) />
</cfif>
@skratchdot
skratchdot / TestDebugStackTrace.java
Created June 5, 2011 18:14
An example class for testing a method of setting conditional breakpoints based off of the hash of the current stack trace.
import java.awt.BorderLayout;
/**
* An example class for testing a method of setting conditional breakpoints
* based off of the hash of the current stack trace.
*
* Eventually, I'd like to edit the Java breakpoint condition editor:
* org.eclipse.jdt.debug.ui.breakpoints.JavaBreakpointConditionEditor.java
* to allow keeping track of the stack trace history for a given breakpoint, and
* only break on certain hashes. It would also be nice to keep a count of each
@skratchdot
skratchdot / ConvertStringToStruct.cfm
Created July 15, 2012 21:34
A ColdFusion function to convert dot notation strings to structs
<cfscript>
private struct function convertStringToStruct(required string key, required any value, string delimiter = ".") {
var obj = StructNew();
var first = ListFirst(arguments.key, arguments.delimiter);
var rest = ListRest(arguments.key, arguments.delimiter);
if (Len(rest)) {
obj[first] = convertStringToStruct(rest, arguments.value, arguments.delimiter);
} else {
obj[first] = arguments.value;
@skratchdot
skratchdot / jq.rb
Created October 21, 2012 18:57 — forked from atdt/jq.rb
Jq formula for Homebrew
require 'formula'
class Jq < Formula
homepage 'http://stedolan.github.com/jq/'
url 'http://stedolan.github.com/jq/download/source/jq.tgz'
sha1 'b3dfaafd1bbe89f04a92036eade3475613078e0c'
version '32e1b114df'
def install
system "make"
@skratchdot
skratchdot / gist:4302457
Last active December 9, 2015 17:18
StackOverflow: Add "Select All" buttons This is a bookmarklet to add a "select all" button above every codeblock on stackoverflow.com. It will toggle selecting the text in the codeblock.
javascript:(function(){var%20b=$('<button%20style="margin:0px%200%2010px%20560px;width:100px;cursor:pointer;border-radius:5px;">Select%20All</button>'),p=$('pre.prettyprint');b.click(function(){var%20o=this,$o=$(o),p=$o.next('.prettyprint')[0],s1=document.selection,s2=window.getSelection,r;$o.toggleClass('active');if(s1){s1.empty();}else%20if(s2){s2().removeAllRanges();}if($o.hasClass('active')){if(s1){r=document.body.createTextRange();r.moveToElementText(p);r.select();}else%20if(s2){r=document.createRange();r.selectNode(p);s2().addRange(r);}}});p.before(b);}());
@skratchdot
skratchdot / gist:4596293
Last active December 11, 2015 11:48
SoundGecko - Listen To Article Bookmarklet
javascript:(function(l){l.href='http://soundgecko.com/listen?source=widget&url='+encodeURIComponent(l);}(document.location));
@skratchdot
skratchdot / RiffWavCuePointExample.java
Created May 15, 2013 16:59
An example of how to setup a cue point chunk. This is an invalid wav file, but shows how to manually add chunks. For an example of adding sample points, see: https://github.com/skratchdot/open-electribe-editor/blob/1a0eb8fd5dad55209335930d7aef142625365b86/com.skratchdot.electribe.model.esx/src/com/skratchdot/electribe/model/esx/impl/SampleImpl.j…
import com.skratchdot.riff.wav.ChunkCue;
import com.skratchdot.riff.wav.ChunkTypeID;
import com.skratchdot.riff.wav.CuePoint;
import com.skratchdot.riff.wav.RIFFWave;
import com.skratchdot.riff.wav.WavFactory;
public class RiffWavCuePointExample {
/**
* @param args
@skratchdot
skratchdot / _init.js
Last active December 17, 2015 11:39
Github Enhancement Suite by skratchdot
var SKRATCHDOT = SKRATCHDOT || {};
@skratchdot
skratchdot / jquery.pruneSiblings.js
Created June 7, 2013 21:50
jquery.pruneSiblings plugin - takes a selector and walks up the dom tree (until reaching a body or html tag), removing siblings along the way.
/*globals jQuery */
(function ($) {
'use strict';
var prune = function (orig, item) {
var parent = item.parent();
item.siblings().remove();
if (parent.length > 0 && !parent.is('body') && !parent.is('html')) {
return prune(orig, parent);
}
return orig;