Skip to content

Instantly share code, notes, and snippets.

@s992
s992 / keybase.md
Last active April 16, 2022 02:28
keybase.md

Keybase proof

I hereby claim:

  • I am s992 on github.
  • I am seanw_ (https://keybase.io/seanw_) on keybase.
  • I have a public key ASAXfjoSHNL42_cgoIS5smI-jenxdU0weKyHqDBd6yYaTwo

To claim this, I am signing this object:

@s992
s992 / post-merge
Created April 21, 2017 05:37 — forked from hultberg/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@s992
s992 / app.js
Last active August 29, 2015 14:07
Rate limiting
(function() {
"use strict";
angular.module( "myApp", [
"rateLimiter"
])
.config([ "rateLimiterConfigProvider", function( rateLimiterConfigProvider ) {
rateLimiterConfigProvider.addLimiter( /api\.battle\.net/, 10, 1100 );
}])
@s992
s992 / gist:23d35ebad8e8988c02c5
Created September 7, 2014 22:23
Migrating Octopress to a New Computer
$ git clone [email protected]:username/username.github.com.git
$ cd username.github.com
$ git checkout source
$ mkdir _deploy
$ cd _deploy
$ git init
$ git remote add origin [email protected]:username/username.github.com.git
$ git pull origin master
$ cd ..
@s992
s992 / geb.groovy
Created June 26, 2014 02:46
Learning geb!
import geb.Browser
import geb.Page
import geb.Module
class NavigationLink extends Module {
def linkText
static content = {
link { $("a", text: linkText) }
@s992
s992 / DiceRoller.groovy
Created February 21, 2014 19:40
Dice Roller
import javax.swing.JOptionPane
// for: http://www.raymondcamden.com/index.cfm/2014/2/21/Friday-Puzzler-Rolling-the-die
class DiceRoller {
static Random random = new Random()
static void main( String[] args ) {
String roller = JOptionPane.&showInputDialog "Enter your roll:"
<cfscript>
function test() {
return "I break when serialized!";
}
writeOutput( serializeJSON( test ) );
</cfscript>
<cfscript>
string = "I'm a string!";
numeric = 12345;
boolean = true;
chromelogger.log( string, numeric, boolean );
</cfscript>
<cfscript>
// Ignore cfscript tags, they're just for syntax highlighting.
component {
...
function onRequestStart() {
if( structKeyExists( url, 'ormDropCreate' ) ) {
dropTables();
ormReload();
@s992
s992 / create.cfm
Created March 20, 2012 20:46
Programmatically Creating New Datasources
<!--- Plug in an existing datasource --->
<cfquery name="qDatabases" datasource="YOUR_DSN_HERE">
SHOW DATABASES;
</cfquery>
<!--- Log in to the CF admin with your password --->
<cfset adminAPI = createObject( 'component', 'cfide.adminapi.administrator' ) />
<cfset adminAPI.login( 'YOUR_PASSWORD_HERE' ) />
<!--- Loop over our query and create datasources for each database in MySQL --->