Skip to content

Instantly share code, notes, and snippets.

@tony-landis
tony-landis / CsvToArray.py
Created December 5, 2008 18:03
Convert CSV string to fixed width text table
"""
Convert CSV string to fixed width text table. Supports multi-line rows, column width limits, and creates a header row automatically
@author Tony Landis
@link http://www.tonylandis.com
@license GPL
"""
from math import ceil
class CsvToTxt():
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@bgreenlee
bgreenlee / autocorrrect.py
Created October 28, 2011 00:01
Simple ngram autocorrect #python #algorithms
import os.path
import collections
from operator import itemgetter
WORDFILE = '/usr/share/dict/words'
class Autocorrect(object):
"""
Very simplistic implementation of autocorrect using ngrams.
"""
@bgreenlee
bgreenlee / gist:1328254
Last active September 27, 2015 20:38
Words with 6 consecutive consonants #words
$ egrep -i "[bcdfghjklmnpqrstvwxz]{6,}" /usr/share/dict/words
archchronicler
bergschrund
Eschscholtzia
fruchtschiefer
latchstring
lengthsman
Nachschlag
postphthisic
veldtschoen
@jonathantneal
jonathantneal / cross-browser-text-selection.js
Created November 8, 2011 05:18
cross-browser-text-selection.js
(function (win, doc) {
function getRangeAtCollapse(range, collapsed) {
// get range as item
if (range.item) {
var rangeItem = range.item(0);
// return the data
return { node: rangeItem };
}
// get range as text
var
@tsabat
tsabat / zsh.md
Last active July 7, 2024 16:56
Getting oh-my-zsh to work in Ubuntu
@kylexlau
kylexlau / del_empty_dirs.py
Created January 6, 2012 05:31
Python delete empty directories, recursive algorithm
import os
def del_empty_dirs(s_dir,f):
b_empty = True
for s_target in os.listdir(s_dir):
s_path = os.path.join(s_dir, s_target)
if os.path.isdir(s_path):
if not del_empty_dirs(s_path):
b_empty = False
@typeoneerror
typeoneerror / Bash.sublime-build
Created January 11, 2012 20:18
Bash build system for running currently open script in Sublime Text 2
{
"cmd" : ["$file"],
"selector" : "source.shell",
"shell" : "bash"
}
@davidnunez
davidnunez / quix.txt
Created January 26, 2012 14:57
davidnunez quix
@Text tools
@Markdown and text manipulation tools
ml javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('Markdown%20Link','['+s+']('+location+')')})();void(0) Copy selected text as Markdown link
mt javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('Markdown%20Title','['+document.title+']('+location+')')})();void(0) Copy title as Markdown link
mu javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('Markdown%20URL','('+location+')')})();void(0) URL as markdown link
mc javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('Markdown%20Copy','['+document.title+']('+location+')\n\n>'+s)})();void(0) Copy selected text as quote with title url in markdown
tc javascript:(function(s){try{s=document.selection.crea
@olifante
olifante / filter_through_command.py
Created February 25, 2012 20:20 — forked from jefftriplett/filter_through_command.py
Sublime Text 2: "Filter Through Command" plugin
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## based on http://pastie.org/private/bclbdgxzbkb1gs2jfqzehg
import sublime
import sublime_plugin
import subprocess
class PromptRunExternalCommand(sublime_plugin.WindowCommand):