Skip to content

Instantly share code, notes, and snippets.

View steder's full-sized avatar
🐧
Being a penguin

Mike Steder steder

🐧
Being a penguin
View GitHub Profile
@steder
steder / starcraft.el
Created March 7, 2012 04:17
Starcraft Minor Mode for Emacs
;; -*- coding: utf-8 -*-
;; starcraft.el -- track user APM (actions per minute) while using Emacs
;;
;; Copyright 2010 by Michael Steder
;; Author: Michael Steder (steder@gmail.com)
;; Created: 2010
;; Version: 1.0
;; Keywords: Actions per minute
;;
;; Inspired by a love of Starcraft and someones offhand comment
@steder
steder / sorted.py
Created January 21, 2012 21:05
Words Blog Post Snippets
import itertools
class Dictionary(object):
def __init__(self):
self.words = {}
def insert(self, word):
letters = "".join(sorted(word))
if letters not in self.words:
self.words[letters] = [word]
@juniorz
juniorz / import.rb
Created January 5, 2012 10:15 — forked from ngauthier/import.rb
Import a blogger archive to jekyll (octopress version)
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@steder
steder / pre-commit.py
Created September 13, 2011 15:11
Git Pre-commit Hook For Python now with extra Python!
#!/usr/bin/env python
#-*- mode: python -*-
from subprocess import Popen, PIPE
import sys
syntax_checker = "pyflakes"
def run(command):
p = Popen(command.split(), stdout=PIPE, stderr=PIPE)
@rwilcox
rwilcox / installing_python_packages_programatically.py
Created December 26, 2010 17:32
How to use PIP to install Python packages programmatically.py
#!/usr/bin/env python
"""
PIP can stand for PIP Installs packages Programmatically, too!
(and here's how)
Requires:
* Python 2.6 or higher (for print-as-a-function)
* PIP 0.8.2
"""