This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//===================================================================== | |
function setKMVar(pstrName, pstrValue) { | |
//===================================================================== | |
var app = Application.currentApplication() | |
app.includeStandardAdditions = true | |
var appKM = Application("Keyboard Maestro Engine") | |
var oVars = appKM.variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
// OSX JavaScript for Applications lacks the persistent 'properties' | |
// of AppleScript (in which global variables and properties persist between script runs) | |
// but we can, of course, serialise to JSON or plist at the end of a script | |
// parsing it at the start of the next run. | |
// Here is one approach to persistence between script runs | |
// using JSON.stringify() and JSON.parse() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat | php -r ' | |
$input = trim(file_get_contents("php://stdin")); | |
$terms = urlencode($input); | |
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&filter=1&rsz=small&q=$terms"; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_REFERER, "G-LINK"); | |
$body = curl_exec($ch); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
=begin | |
Planter v1.3 | |
Brett Terpstra 2013 | |
ruby script to create a directory structure from indented data. | |
Three ways to use it: | |
- Pipe indented (tabs or 2 spaces) text to the script | |
- e.g. `cat "mytemplate" | planter.rb | |
- Create template.tpl files in ~/.planter and call them by their base name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Speed up Mail.app by vacuuming the Envelope Index | |
Code from: http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/ | |
Originally by "pmbuko" with modifications by Romulo | |
Updated by Brett Terpstra 2012 | |
Updated by Mathias Törnblom 2015 to support V3 in El Capitan and still keep backwards compability | |
Updated by @lbutlr for V5 and Container folder in High Sierra and use du | |
*) | |
tell application "Mail" to quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = jQuery | |
$.fn.extend | |
tweetArea: (options) -> | |
settings = | |
offset: 21 | |
charDisplay: '#char-count' | |
warnAt: 120 | |
postBox: '#tweet-area' | |
max: 140 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Requires 'sequel' and 'mysql' rubygems | |
require 'rubygems' | |
require 'sequel' | |
require 'cgi' | |
def e_sql(str) | |
str.to_s.gsub(/(?=[\\])/, "\\") | |
end |