Skip to content

Instantly share code, notes, and snippets.

@karschsp
karschsp / lookup.js
Created June 30, 2011 02:35
Trying to read post in node.js
var app = express.createServer(express.logger(), express.bodyParser(), function(req, res){
switch (req.url) {
case '/':
res.write(
'<h1>ZIP Lookup</h1>'+
'<form method="post" action="/lookup" enctype="multipart/form-data">'+
'<fieldset>'+
'<label for="zip">Zip: </label>'+
'<input type="text" name="zip" id="zip"></input>'+
'<input type="submit" value="Submit" />'+
@karschsp
karschsp / ironhill-media.py
Created August 28, 2012 04:26
Parse Iron Hill Media beer list
#! /usr/bin/env python
import urllib2 as l2
import lxml.html
import smtplib
from lxml.cssselect import CSSSelector
tappath='//h4[@class="monthly"]'
url = 'http://www.ironhillbrewery.com/media/monthly-releases.htm'
resp = l2.urlopen(url)
data = resp.read()
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.host_name = "local"
config.vm.customize ["modifyvm", :id, "--memory", "2048"]
config.vm.box = "vagrant-centos-64"
config.vm.box_url = "http://stevekarsch.com/sites/default/files/vagrant-centos-64.box"
#config.ssh.forward_agent = true
end
function vtx_common_update_7102() {
$module_list = array(
'maxlength',
'imagefield_focus',
);
module_enable($module_list);
}
@karschsp
karschsp / gist:9043930
Created February 17, 2014 02:57
Method of mounting synced folders in Vagrant so Drupal 8 will install
config.vm.synced_folder "www", "/vagrant/www", :mount_options => ["dmode=777,fmode=777"]
@karschsp
karschsp / gist:08d417521af3400e811c
Last active August 29, 2015 14:01
The Value of Coding Standards

We collaborate a lot at Blink Reaction. Not just internally, but with client development teams, our partners and, of course, the Drupal community.

Recently, a co-worker asked a question in our developer chat about the value of coding standards. He clearly understood it, however, the client he was working with was committing code to the sites git repo that was not in line with the (Drupal coding standards)[https://drupal.org/coding-standards]

The question he was asking, to paraphrase, was "How do I sell this client on the value of coding standards?"

We went around a bit, and came up with the following four:

@karschsp
karschsp / gist:6d838581dfafeb16d500
Created June 18, 2014 19:40
JavaScript redirect
<script type="text/javascript">
var delay = 3000; //Your delay in milliseconds
URL='http://www.ingfunds.com/globalperspectives/signin';
setTimeout(function(){ window.location = URL; }, delay);
</script>
jQuery('input.capture_mailingAddress_postalCode').attr('maxlength', '25');
$("input.capture_mailingAddress_postalCode").keypress(function(event) {
// Backspace, tab, enter, end, home, left, right
// We don't support the del key in Opera because del == . == 46.
var controlKeys = [8, 9, 13, 35, 36, 37, 39];
// IE doesn't support indexOf
var isControlKey = controlKeys.join(",").match(new RegExp(event.which));
// Some browsers just don't raise events for control keys. Easy.
// e.g. Safari backspace.
if (!event.which || // Control keys in most browsers. e.g. Firefox tab is 0
diff --git a/source/ve/edit-profile.js b/source/ve/edit-profile.js
index 89f6979..a98b30d 100644
--- a/source/ve/edit-profile.js
+++ b/source/ve/edit-profile.js
@@ -170,7 +170,7 @@ if(!Array.prototype.indexOf){Array.prototype.indexOf=function(e){"use strict";if
function postCodeValidation(name, value, validation) {
- return janrainPfizer.commonValidation(value, validation, /{%regexp_postcode%}/);
+ return janrainPfizer.commonValidation(value, validation, /^\d{25}$/);