Skip to content

Instantly share code, notes, and snippets.

String.prototype.validate = function (regex) {
var pattern = {
zip: /^\d{5}([\-])?$/,
email: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
ip: /(?:\d{1,3}\.){3}\d{1,3}/
};
return pattern[regex].test(this.trim());
}
> console.log(util.inspect(Date, true, null))
{ [Function: Date]
[now]: { [Function: now] [arguments]: null, [length]: 0, [name]: 'now', [caller]: null },
[arguments]: null,
[UTC]: { [Function: UTC] [arguments]: null, [length]: 7, [name]: 'UTC', [caller]: null },
[length]: 7,
[name]: 'Date',
[prototype]:
{ Invalid Date
[constructor]: [Circular],
@luk-
luk- / ziptastic.html
Created April 11, 2012 02:18
ziptastic
<script type="text/javascript">
var client = new XMLHttpRequest();
client.open("GET", "http://zip.elevenbasetwo.com?zip=48867", true);
client.onreadystatechange = function () {
if(client.readyState == 4) {
alert(client.responseText);
};
};
curl http://api.nodejitsu.com -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11' -v
[ { '@':
{ b1: '475174',
start_tfs_zulu: '2012-04-17T03:12:59Z',
event: 'Single',
start_tfs: '231259',
num: '75',
b2: '460026',
pitcher: '543022',
batter: '475174',
b3: '',
NameVirtualHost *:80
<Directory /var/www/>
AllowOverride All
</Directory>
<VirtualHost *:80>
</VirtualHost>
Include sites-enabled/*
<VirtualHost *:80>
ServerName mtambo.com
ServerAlias www.mtambo.com
DocumentRoot /var/www/mtambo.com/htdocs
ErrorLog /var/www/mtambo.com/logs/error.log
CustomLog /var/www/mtambo.com/logs/acomess.log common
</VirtualHost>
if (err || !files) return (err ? console.log(err) : (function() {throw new Error('no files')})())
{
"author": "Joshua Holbrook",
"name": "hoarders",
"description": "node.js's most complete \"utility grab-bag\". Dedicated to substack.",
"version": "0.0.0",
"dependencies": {
"27bslash6-module": "*",
"2co": "*",
"2csv": "*",
"2kenizer": "*",
#!/bin/bash
ip=`/usr/bin/curl -s ipv4.icanhazip.com`
echo -n $ip | /usr/bin/pbcopy
echo $ip