Skip to content

Instantly share code, notes, and snippets.

View lsloan's full-sized avatar

Mr. Lance E Sloan «UMich» lsloan

  • Teaching and Learning (@tl-its-umich-edu) at University of Michigan: Information and Technology Services
  • Ann Arbor, Michigan, USA
  • 20:33 (UTC -04:00)
  • X @lsloan_umich
View GitHub Profile
@lsloan
lsloan / Toggle Character Viewer.workflow
Created June 12, 2015 18:12
When saved as an Automator workflow service in OS X, this Applescript will toggle the visibility of the character viewer palette. This is useful in older versions of OS X, which didn't provide easy access to special characters like emoji, etc. I bound this workflow to the Command-Option-Control-C key press for easy access.
on isRunning(applicationName)
tell application "System Events"
set appNameIsRunning to exists ¬
(processes where name is applicationName)
end tell
return appNameIsRunning
end isRunning
on run {input, parameters}
@lsloan
lsloan / List GitHub Projects Using jQuery
Last active February 6, 2020 16:06 — forked from tantalor/github.jquery.js
An example JavaScript program using jQuery to get a list of GitHub projects.
Gist title: "List GitHub Projects Using jQuery"
Summary: An example JavaScript program using jQuery to get a list of GitHub projects.
Original source: http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html
@lsloan
lsloan / Basic LTI Launcher
Last active August 29, 2015 14:24
Basic LTI Launcher
See the entry point in file "blti-launch.html".
@lsloan
lsloan / api_config.ini
Created July 14, 2015 16:07
Using arrays from config files with Zend Framework
analytic_sensor_id = "05D2D6AB-B9CE-4BAC-98FB-EB96F25F0D29"
analytic_endpoint_url[localhost8000] = "http://localhost:8000/"
analytic_api_key[localhost8000] = "snafu"
analytic_endpoint_url[localhost9000] = "http://localhost:9000/"
analytic_api_key[localhost9000] = "fubar"
@lsloan
lsloan / stack_trace.php
Last active August 29, 2015 14:25
A one-line solution to send an edited stack trace to the error log.
<?php
// Print stack trace, removing repeated absolute path on each file
error_log(str_replace($_SERVER['DOCUMENT_ROOT'], '', (new Exception())->getTraceAsString()));
@lsloan
lsloan / requestbin_timestamp.js
Created July 16, 2015 18:39
Replace RequestBin's relative times with absolute ones.
$('div.span2 span').each(function() {
$span = $(this);
$span.text($span.attr('title'));
});
@lsloan
lsloan / JsonPlus.php
Last active August 29, 2015 14:26
JsonPlus is a wrapper for PHP's json_encode(), which shamefully lacks the ability to automatically remove certain values from the JSON it produces.
<?php
/**
* Class JsonPlus
*/
class JsonPlus {
/**
* A wrapper for json_encode() with the ability to run a filter on the data first.
*
* @param mixed $value
@lsloan
lsloan / QuickLook text selection.md
Created September 18, 2015 15:21
A command to enable text selection from Apple OS X Finder QuickLook windows.

Run this in your terminal to allow text selection in the QuickLook window:

defaults write com.apple.finder QLEnableTextSelection -bool true && killall Finder
@lsloan
lsloan / setjdk.sh
Last active February 4, 2020 15:39
setjdk() function for bash: Use "setjdk 1.7", "setjdk 1.8", or "setjdk" (to see current setting).
# Adapted from http://superuser.com/a/568016/64151
# Add this function to .bash_profile, then use
# "setjdk 1.7", "setjdk 1.8", or "setjdk" (to see current setting).
function setjdk() {
if [ $# -ne 0 ]; then
function removeFromPath() {
export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'