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
var Counter = { | |
_c: {}, | |
get: function(c) { return Counter._c[c] || 0; }, | |
set: function(c, v) { Counter._c[c] = v; return v; }, | |
inc: function(c, v) { return Counter.set(c, Counter.get(c) + (v || 1)); }, | |
dec: function(c, v) { return Counter.inc(c, (v ? -v : -1)); } | |
}; | |
/** | |
* Usage: |
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
Pinger = function(opts) { for (var o in opts) { this.config[o] = opts[o]; } } | |
Pinger.prototype = { | |
running: false, | |
config: { | |
host : document.location.host, | |
secure : (document.location.protocol == "https:"), | |
script : '', | |
interval : 300 // interval time in seconds | |
}, | |
start: function() { this.running = true; this.schedule(); }, |
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
<cffunction name="myFunc"> | |
<!-- | |
What's going on here? Basically, any <cfinclude>d view files run within the scope | |
of this function, which means any variables used are effectively unscoped in terms | |
of the component. Because we're caching the view component it means we could end up | |
with nasty race conditions. By var-ing a new 'variables' scope it effectively | |
localises any variable usage (scoped or unscoped) within both the function call and | |
any included files. We also make a reference to the original (component) 'variables' | |
scope in to a new named 'scope' called 'global', so any calls to functions within |
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
#!/bin/bash | |
defaults write NSGlobalDomain NSUserKeyEquivalents '{"Zoom" = "@^Z"; "Zoom Window" = "@^Z"; }' |
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
Index: framework/Assert.cfc | |
=================================================================== | |
--- framework/Assert.cfc (revision 1148) | |
+++ framework/Assert.cfc (working copy) | |
@@ -128,21 +128,23 @@ | |
<cfargument name="expected" type="any" required="yes" hint="The expected string value" /> | |
<cfargument name="actual" type="any" required="yes" hint="The actual string value" /> | |
<cfargument name="message" required="false" default="This test failed" hint="Custom message to print in the failure." /> | |
+ <cfargument name="caseSensitive" type="boolean" required="false" default="false" hint="If set to TRUE checks the original string unaltered. Default is to check the string in lowercase" /> | |
<cfset arguments = normalizeArguments("equals",arguments)> |
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
/* | |
As of version 1.1.2, Propane will load and execute the contents of | |
~Library/Application Support/Propane/unsupported/caveatPatchor.js | |
immediately following the execution of its own enhancer.js file. | |
You can use this mechanism to add your own customizations to Campfire | |
in Propane. | |
Below you'll find two customization examples. |
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
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.6/ext/apache2/mod_passenger.so | |
PassengerRoot /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.6 | |
PassengerRuby /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby |
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
$ curl --silent -i http://ojp.nationalrail.co.uk/ | grep 'Powered-By' | |
X-Powered-By: An infinite number of monkeys |
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
# Incredibly simple HTTP proxy that takes `GET` requests of the form | |
# | |
# http://127.0.0.1:12345/www.domain.com/path/to/resource | |
# | |
# and proxies to | |
# | |
# http://www.domain.com/path/to/resource | |
# | |
# All body content and headers are passed through untouched. | |
# |
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
#!/usr/bin/env ruby | |
# A simple wrapper to the command-line `markdown` tool which wraps | |
# HTML header and footer, including any style references you choose. | |
require 'open3' | |
require 'erb' | |
# Define the ERB template to wrap the HTML content in. | |
template = ERB.new <<-EOS |
OlderNewer