Skip to content

Instantly share code, notes, and snippets.

View saw's full-sized avatar

Stephen Woods saw

View GitHub Profile
@saw
saw / mm_
Created June 19, 2014 20:57
Remember this chestnut?
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
@saw
saw / gist:e9927ef786c6609c0b05
Created July 23, 2014 05:18
Now that's what I call routing...
○ 🐓 : traceroute www.yahoo.com
traceroute: Warning: www.yahoo.com has multiple addresses; using 98.139.183.24
traceroute to ds-any-fp3-real.wa1.b.yahoo.com (98.139.183.24), 64 hops max, 52 byte packets
1 router.asus.com (192.168.1.1) 2.187 ms 0.784 ms 0.722 ms
2 69.181.192.1 (69.181.192.1) 49.328 ms 15.622 ms 37.608 ms
3 te-5-1-ur02.sf19th.ca.sfba.comcast.net (68.85.103.121) 47.220 ms 60.199 ms *
4 68.86.143.106 (68.86.143.106) 48.758 ms * 44.245 ms
5 te-9-4-ur01.fremont.ca.sfba.comcast.net (68.87.192.61) 36.500 ms 58.571 ms 34.786 ms
6 be-90-ar01.sfsutro.ca.sfba.comcast.net (68.85.155.14) 41.738 ms
te-1-14-0-3-ar01.sfsutro.ca.sfba.comcast.net (68.85.57.46) 24.992 ms 45.905 ms
@saw
saw / test.c
Created October 28, 2014 15:44
Does not compile!
#include <stdio.h>
int Main(int argc, char *argv[])
{
puts("hello");
return 1;
}
/*
@saw
saw / gist:d826c410c6c7f75d27ba
Last active August 29, 2015 14:17
Switch iterm2 profile per host
# for this to work you need to create
# a profile for each host, or set of hosts or whatever.
# to make sure it is always current add this to your
# PROMPT_COMMAND so it runs every time, rather just at login.
if [ "$HOSTNAME" = "myhost1" ]; then
echo -ne "\033]50;SetProfile=myhost1\007"
fi
if [ "$HOSTNAME" = "myhost2" ]; then
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Multiplication Tables</title>
</head>
<body>
<h1>{{message}}</h1>
<div id="table">
var b=[],c=1;function d(a){var e=[],f=0;a&&b.push(a.join("\t"));for(a=0;a<10;a++)e.push(++f*c);c++<11&&d(e)}d();alert(b.join("\n"));
YModules["myshortcutmenus"] = {
init:function(api){
//store the api
this.api = api;
this.Y = api.getService('yui');
},
//called when the view is ready in the dom
onviewload:function(v){
var v = new RegExp();
v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
if (!v.test(url)) {
return false;
}
return true;
sudo java -jar /usr/local/jars/yuicompressor-flickr-2.4.3.jar -o '.source.css$:-min.css' /var/www/html/stage-svn.flickr.com/css/*.source.css
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:20)
Caused by: java.lang.StackOverflowError
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
@saw
saw / gist:2401551
Created April 16, 2012 21:14
My new commenting style...
;('my new commenting style')