Skip to content

Instantly share code, notes, and snippets.

--langdef=js
--langmap=js:.js
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\{/\5/,object/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\5/,function/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\[/\5/,array/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[^"]'[^']*/\5/,string/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*(true|false)/\5/,boolean/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[0-9]+/\5/,number/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*.+([,;=]|$)/\5/,variable/
--regex-js=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*[ \t]*([,;]|$)/\5/,variable/
try {
$.browser.msie && $.browser.version < 7
&& document.execCommand( 'BackgroundImageCache', false, true );
} catch(e) { };
@grahams
grahams / Getmail .rc for Gmail
Created February 28, 2011 22:40
the rc file I use for my Gmail backups.. I run getmail daily from cron
[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = someawesomegmailaccountname@gmail.com
password = asupersecurepassword
[destination]
type = Maildir
path = ~/.gmailbackup/
@grahams
grahams / gist:935953
Created April 22, 2011 03:27
mplayer brew failure
tacoby:[~]$ sudo chown -R `whoami` /usr/local
tacoby:[~]$ brew update
From http://github.com/mxcl/homebrew
* branch master -> FETCH_HEAD
Already up-to-date.
tacoby:[~]$ brew install -v mplayer
==> Checking out svn://svn.mplayerhq.hu/mplayer/trunk
/usr/bin/svn up --force svn://svn.mplayerhq.hu/mplayer/trunk /Users/grahams/Library/Caches/Homebrew/mplayer--svn
Skipped 'svn://svn.mplayerhq.hu/mplayer/trunk'
@grahams
grahams / gist:941783
Created April 26, 2011 04:13
MakeM4B Error
Posting to Wordpress
Making a copy of the archive as an m4a...
ChapterTool 2.0.0.12
Copyright (C) 2005, Apple Computer, Inc., all rights reserved.
/Users/grahams/aatemp/News/-Episode%20127/Episode_127.xml:5: element picture: Schemas validity error : Element 'picture': 'art/128272820306.aem.AEType('PNG\x20')' is not a valid value of the local atomic type.
/Users/grahams/aatemp/News/-Episode%20127/Episode_127.xml:21: element picture: Schemas validity error : Element 'picture': 'art/233642352319.aem.AEType('PNG\x20')' is not a valid value of the local atomic type.
/Users/grahams/aatemp/News/-Episode%20127/Episode_127.xml:25: element picture: Schemas validity error : Element 'picture': 'art/262585588503.aem.AEType('PNG\x20')' is not a valid value of the local atomic type.
/Users/grahams/aatemp/News/-Episode%20127/Episode_127.xml:33: element picture: Schemas validity error : Element 'picture': 'art/336319581509.aem.AEType('PNG\x20')' is not a valid value of the local atomic type.
/Users/grahams/aatemp/News/-Episo
@grahams
grahams / stay_standalone.js
Created June 23, 2011 11:50 — forked from kylebarrow/example.html
Prevent links in standalone web apps opening Mobile Safari
// Mobile Safari in standalone mode
if(("standalone" in window.navigator) && window.navigator.standalone){
window.addEventListener("load",function() {
links = document.getElementsByTagName('a');
for (var i=0; i < links.length; i++)
{
// Don't do this for javascript: links
@grahams
grahams / gist:1216530
Created September 14, 2011 13:20
nethack build succeeds: 2335-10.7
tacoby:[~]$ brew install nethack
Warning: Building with LLVM, but this formula is reported to not work with LLVM:
(No specific reason was given)
We are continuing anyway so if the build succeeds, please open a ticket with
the following information: 2335-10.7. So
that we can update the formula accordingly. Thanks!
If it doesn't work you can: brew install --use-gcc
@grahams
grahams / playlist.py
Created February 12, 2012 02:52
a little script to help rebuild playlists from m3u files even if the file paths don't match. You'll get false positives as the search is intentionally inclusive. I don't really have a need to polish this up, but thought others may be able to jump off fr
#!/usr/bin/env python
from appscript import app,k
import re
import glob
pluginDir = "/Users/grahams/Desktop/playlists/"
it = app(u"iTunes")
@grahams
grahams / Messages.app Growl Script
Created February 22, 2012 15:35
Jam this text into AppleScript Editor and save it into ~/Library/Scripts/iChat and use the Messages -> Preferences -> Alerts tab. Select "Run an AppleScript Script" and select this script. (Based on http://goo.gl/WUsrM.)
property growlAppName : "Growl iChat"
property notificationNames : {"Message Received", ¬
"Completed File Transfer"}
property defaultNotificationNames : {"Message Received", ¬
"Completed File Transfer"}
using terms from application "iChat"
on message received theText from theBuddy for theTextChat
@grahams
grahams / gist:1911191
Created February 25, 2012 22:28
Script to invoke tivodecode using pv for a progress indicator.
#!/usr/bin/env bash
BASENAME=`basename "$1" .TiVo`
pv "$1" | /usr/local/bin/tivodecode -m 1234567890 -o "$BASENAME".mpg -