Skip to content

Instantly share code, notes, and snippets.

View JT5D's full-sized avatar
💭
Multiversing...

JT5D JT5D

💭
Multiversing...
View GitHub Profile
@JT5D
JT5D / westlaw_scraper.js
Created September 15, 2012 17:50
WestLaw Scraper
// ==UserScript==
// @name WestLaw Scraper
// @namespace http://userscripts.org/users/
// @include http://weblinks.westlaw.com/result/*
// @require http://code.jquery.com/jquery-1.8.1.min.js
// @require https://raw.github.com/tmcw/happen/master/src/happen.js
// @version 1
// @grant GM_log
// ==/UserScript==
-- This script includes examples for using AppleScript to perform several
-- useful tasks with Evernote.
-- Each section illustrates a chunk of Evernote's AppleScript interface,
-- and each section also cleans up after itself.
-- Please refer to the Evernote application's scripting dictionary for
tell application "Evernote"
set myNote to create note with text "hello world"
set noteLink to null
synchronize
repeat 10 times
if (note link of myNote as text) is equal to missing value then
log "still syncing"
else
set noteLink to (note link of myNote as text)
log noteLink
@JT5D
JT5D / flare.json
Created March 4, 2013 06:35 — forked from mbostock/.block
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
# Ported by Matt Sullivan http://sullerton.com/2011/03/django-mobile-browser-detection-middleware/
import re
reg_b = re.compile(r"android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino", re.I|re.M)
reg_v = re.compile(r"1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea
-- Get the text from Safari
tell application "Safari"
set thePageText to text of document 1
end tell
-- Split the text into paragraphs
set thePars to paragraphs of thePageText
-- Find all paragraphs matching the desired criteria
set theText to ""
-- Options to process a maximum number of messages
property limitMessageProcessing : true
property theMaxMessagesToProcess : 5
-- The voice to use when speaking. This should be one of the voices in System Preferences > Dictation & Speech > Text to Speech
property theVoice : "Alex"
-- Tihs setting controls whether the script raises the volume to speak, if needed.
property raiseVolumeIfNeeded : true
-- This property controls the calendar on which the event is added
set theCalendarName to "AppleScripts"
-- Prompt the user to select a script to attach to an event. This should be an application.
set theScriptToTrigger to choose file with prompt "Please select a saved AppleScript application to attach to an event:" of type "app"
-- Get the script's name
set theScriptToTriggerName to displayed name of (info for theScriptToTrigger)
-- Check for the existence of the target calendar, creating it if it doesn't already exist