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
  • 02:43 (UTC -04:00)
  • X @lsloan_umich
View GitHub Profile
@falexandrou
falexandrou / view-pdf.js
Last active August 29, 2015 13:57
Display PDF files inline
/**
* When browser supports inline pdfs
* There is no need to append a large jquery plugin that displays them inline.
*
* You can actually use an iframe (and style it appropriately)
* or a link whenever inline PDF viewing is not supported
*
* This function is fairly simple and it's only for demo purposes
*/
function appendPdf(id, url) {
@apetro
apetro / github_as_wiki_transcript.md
Created June 24, 2014 13:23
Transcript of GitHub as Wiki lightning talk

GitHub as a Wiki

Note: this is a reasonably faithful verbatim transcript of a live conference lightning talk, not a re-worked blog format presentation of this content.

Links:

  • [Slides][]
  • [YouTube recording of presentation][]
  • [Lanyrd entry][]

This is a list of tips for the Vim editor

@eedrummer
eedrummer / gist:741573
Created December 15, 2010 03:10
Using Underscore.js with MongoDB
require 'mongo'
require 'ap'
include Mongo
# Create a connection to a local MongdDB Instance
db = Connection.new.db('underscore-demo')
# Read and eval Underscore.js
underscore = File.read('underscore-min.js')
@mfilej
mfilej / Character Viewer.scpt
Created June 19, 2011 09:26
Open OS X's Character Viewer via AppleScript (10.6)
tell application "Finder"
open item "System:Library:Input Methods:CharacterPalette.app" of the startup disk
end tell
@al3xandru
al3xandru / gist:1156476
Created August 19, 2011 09:48
Open iTerm in Current Folder
on run {input, parameters}
tell application "Finder"
set sel to selection
if (count sel) > 0 then
set myTarget to item 1 of sel
else if (count window) > 0 then
set myTarget to target of window 1
else
set myTarget to path to home folder
end if
@rca
rca / serve.py
Created November 13, 2012 01:37
SimpleHTTPServer subclass that sends custom headers
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
@lsloan
lsloan / composer_notebook.md
Last active December 11, 2015 16:52
My Composer notebook

Composer Notebook

  1. Ignoring the cache: Composer doesn't have an option to make it ignore its cache while running a command. The Composer developers do not believe this is an important feature and they refused an issue opened to request it. However, it can be helpful for debugging dependency installation. To make a single Composer command (e.g., composer update) ignore the cache, use one of the following:

    1. This version generates innocuous, ignorable errors about the cache directory:

      COMPOSER_CACHE_DIR=/dev/null composer update
@cclauss
cclauss / theBlues.py
Last active December 14, 2015 10:38
Play a blues melody on Pythonista on the iPad (iOS)
# Play a blues melody on Pythonista on the iPad (iOS)
import sound
import time
def playNotes(inNotes, inWithEmphisis=False):
for note in inNotes:
sound.play_effect('Piano_' + note)
if (inWithEmphisis):
time.sleep(0.25)
sound.play_effect('Piano_' + note)
@omz
omz / Primes.py
Created March 3, 2013 15:48
Primes
# Demo of how to generate a list of prime numbers and cache them
# in a data file for fast access (using the marshal module).
def gen_primes(n):
# Source: http://code.activestate.com/recipes/366178-a-fast-prime-number-list-generator/#c19
s = range(0, n+1)
s[1] = 0
bottom = 2
top = n // bottom
while (bottom * bottom <= n):