Skip to content

Instantly share code, notes, and snippets.

Jack Letourneau jletourneau

Block or report user

Report or block jletourneau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jletourneau
jletourneau / unfill.el
Last active Nov 19, 2015
Unfilling paragraphs in Elisp
View unfill.el
(defun unfill-region (start end)
"Unfill the current region; i.e. remove all newlines within paragraphs.
If an active region is not present, unfill the entire buffer."
(interactive "r")
(let ((fill-column (point-max)))
(if (use-region-p)
(fill-region start end)
(fill-region (point-min) (point-max)))))
@jletourneau
jletourneau / timed_mute.scpt
Last active Aug 29, 2015
Timed mute AppleScript
View timed_mute.scpt
global mute_time
global wait_complete
on run
display dialog "Mute for how many seconds?" default answer "120"
set mute_time to text returned of result as number
set volume with output muted
set wait_complete to 0
View keybase.md

Keybase proof

I hereby claim:

  • I am jletourneau on github.
  • I am jlet (https://keybase.io/jlet) on keybase.
  • I have a public key whose fingerprint is 4B2D AA0A 3C84 DD6C 05D5 DA48 C307 2D17 4882 FA40

To claim this, I am signing this object:

@jletourneau
jletourneau / bg_gradient.html
Created Feb 20, 2015
CSS text background gradients
View bg_gradient.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS text gradient</title>
<style type="text/css">
h1 {
display: inline;
font: bold 72px 'Helvetica Neue', Helvetica, sans-serif;
line-height: 1;
@jletourneau
jletourneau / gist:4950200
Created Feb 14, 2013
AppleScript to eject all ejectable volumes. Useful for quickly disconnecting a laptop from external drives etc. for traveling.
View gist:4950200
tell application "Finder"
eject (every disk whose ejectable is true)
end tell
@jletourneau
jletourneau / hydra-intro.md
Created Oct 24, 2012
Plugging Hydra into your game
View hydra-intro.md

Plugging Hydra into your game

This documentation explains how to build Hydra profile support into an existing game. As our example, we’ll be working with a very simple “game” called Masher, written in Python, which prompts the user for their name, reads lines of input one at a time, and adds up the number of characters the user has entered.

The original version of the game stores the user’s name, rounds played, and count of characters typed in a data structure which is saved to a file on disk using Python’s pickle module. Our goal is to modify this game to store the player’s data in Hydra instead.

Setting up Hydra to start accepting data

@jletourneau
jletourneau / masher.py
Created Oct 24, 2012
Masher, pre-Hydra integration
View masher.py
#!/usr/bin/env python
import sys, os, pickle
from collections import defaultdict
class Masher:
def __init__(self, savefile):
self._savefile = savefile
self._read_profile()
@jletourneau
jletourneau / battery-info.py
Created Oct 10, 2012
OS X battery info in Python
View battery-info.py
#!/usr/bin/env python
import subprocess, re
def battery_info():
ioreg = subprocess.check_output(
['ioreg', '-r', '-w0', '-cAppleSmartBattery']
).split("\n")
d = dict()
for line in ioreg:
@jletourneau
jletourneau / tesla.py
Created Jul 11, 2012
Demo code sample
View tesla.py
import utils
@utils.memoize
def fib(n):
if n < 3:
return 1
return fib(n - 2) + fib(n - 1)
(i, sum) = (1, 0)
while True:
@jletourneau
jletourneau / helper.rb
Created Jun 29, 2012
Haml helper for IE conditional comments visible to non-IE browsers
View helper.rb
def iecc_visible(condition, &block)
output = capture_haml(&block)
"<!--[#{condition}]><!-->#{output.chomp}<!--<![endif]-->\n"
end
You can’t perform that action at this time.