Skip to content

Instantly share code, notes, and snippets.

View patrickkettner's full-sized avatar

patrick kettner patrickkettner

View GitHub Profile
@patrickkettner
patrickkettner / gist:964332
Created May 10, 2011 11:53
tinkering with node.io
var nodeio = require('node.io');
exports.job = new nodeio.Job({
input: process.argv.splice(3),
run: function(domain) {
var self = this;
try { //make sure it is a url
self.assert(domain).isUrl();
this.getHtml(domain, function(err, $) {
if (err) {
if (err === "redirects") {
@patrickkettner
patrickkettner / gist:968279
Created May 12, 2011 10:03
engadget crashing jsdom
var jsdom = require('jsdom');
jsdom.env('http://engadget.com', [
'http://code.jquery.com/jquery-1.5.min.js'], function(errors, window) {
var $ = window.$;
if (errors) {
console.log(errors);
}
@patrickkettner
patrickkettner / gist:974110
Created May 16, 2011 08:50
youtube cleaner
#watch-discussion {
display: none;
}
#watch-sidebar {
display: none;
}
#footer {
display: none;
}
#footer-container {
@patrickkettner
patrickkettner / gist:1000151
Created May 31, 2011 08:11
jquery translate party - javascript to coffescript and back again
jQuery source used
/*!
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@patrickkettner
patrickkettner / gist:1645357
Created January 20, 2012 05:00
clisp fails to install
➜ ~ brew install -v clisp
==> Downloading http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2
File already downloaded in /Users/pdk/Library/Caches/Homebrew
/usr/bin/tar xf /Users/pdk/Library/Caches/Homebrew/clisp-2.49.tar.bz2
==> Downloading patches
/usr/bin/curl -qf#LA Homebrew 0.8.1 (Ruby 1.8.7-249; Mac OS X 10.7.2) https://svn.macports.org/repository/macports/!svn/bc/89054/trunk/dports/lang/clisp/files/patch-src_lispbibl_d.diff -o 001-homebrew.diff
######################################################################## 100.0%
==> Patching
/usr/bin/patch -f -p0 -i 001-homebrew.diff
patching file src/lispbibl.d
@patrickkettner
patrickkettner / gist:1685535
Created January 26, 2012 22:32
keyframe test canidate
var D = document,
Db = D.body;
function De(x) { return D.createElement(x); }
function Dt(x) { return D.createTextNode(x); }
function Da(x) { return Db.appendChild(x); }
function Dr(x) { return Db.removeChild(x); }
function Dg(x) { return document.getElementById(x); }
var s = De('style'),
ss = s.styleSheet,
vendors = ['-moz-','-ms-','-webkit-', ''],
@patrickkettner
patrickkettner / american phone number regex
Created January 31, 2012 22:40
allows for optional parens, dashes, dots, and country code
^(?:(?:\+?1\s*(?:[.-]\s*)?)?(\()?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])(\))?\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$
@patrickkettner
patrickkettner / regex password validation
Created February 3, 2012 01:41
requires two non consecutive special chars, one of more digits, and be between 8 and 20 chars
((?=.*\d)(?=(.*[!#$%&()*+,-./:;<=>?@[\]\^_`{|}~]){2,}).{8,20})
13:28:51,773 DEBUG MDCMAuthenticationProvider:49 - Authenticating User: admin
13:28:51,773 DEBUG MDCMAuthenticationProvider:50 - calling loginAndSaveUserIdAndSessionToken
13:28:51,783 DEBUG WebServiceTemplate:110 - Opening [org.springframework.ws.transport.http.HttpUrlConnection@6ff80c0e] to [http://localhost:8080/MDCMWebServices/messages/]
13:28:51,849 DEBUG sent:579 - Sent request [SaajSoapMessage {http://www.mdcm.com/schema}loginAndSaveSessionTokenRequest]
13:28:51,873 DEBUG TransportUtils:48 - Could not close WebServiceConnection
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;}
.a { color: #FBFBFB; font-family: sans-serif; width: 40px; display: inline-block; margin: 0; padding-top: 1px; height: 20px; vertical-align: top; margin: 0 -4px; text-shadow: 0 1px 0 black; border-radius: 3px;}
.b { position: relative; left: 20px; width: 100px; margin: 0 -100px 0 0; padding: 0; opacity: 0}
label { text-align: center;}
#toggle-1 { -webkit-transition: margin 0.2s ease-in-out;}
#toggleLabel { background-color: #2d4266; margin-right: -5px; border-top-right-radius: 0; border-bottom-right-radius: 0;}
#toggle-1:checked { margin-left: -65%}
#switch { height: 20px; margin: 0; padding: 0; margin: 0; border: 1px solid #d1d1d1; background: lightgray; background-color: #a7a7a7; background-image: -webkit-gradient(linear, left top, left bottom, from(#a7a7a7), to(#FBFBFB)); /* Saf4+, Chrome */ background-image: -webkit-