Skip to content

Instantly share code, notes, and snippets.

@tylerball
tylerball / snippet
Created March 17, 2014 19:42
upside down text textexpander snippet, use like: (╯°□°)╯︵ %snippet:;updn%
#!/usr/bin/python
# vim: set fileencoding=utf-8
# inspired by:
# https://github.com/JKodner/upsdwn/blob/master/upsdwn.py
import sys
import subprocess
clip = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)

Keybase proof

I hereby claim:

  • I am tylerball on github.
  • I am tylerball (https://keybase.io/tylerball) on keybase.
  • I have a public key whose fingerprint is 10E6 8CEF 19FE 1962 021C A78C 68F4 DDE7 1842 49C3

To claim this, I am signing this object:

@tylerball
tylerball / jekyll-textile2markdown.rb
Created September 12, 2014 14:18
I had a bunch of jekyll posts written in textile with yaml frontmatter I needed to convert to markdown
require 'preamble'
require 'pandoc-ruby'
Dir.glob('*.textile').each do |file|
front = Preamble.load(file)
converter = PandocRuby.new(front.content, from: :textile, to: :markdown)
markdown = converter.convert
new_file = Preamble.new(front.metadata, markdown)
new_file.save(file.sub('textile', 'markdown'))
end
@tylerball
tylerball / ;_updnc.snippet
Last active August 29, 2015 14:07
upside down
#!/usr/bin/python
# vim: set fileencoding=utf-8
# inspired by:
# https://github.com/JKodner/upsdwn/blob/master/upsdwn.py
import sys
import subprocess
clip = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
(function() {
var autolink=function(text){
var pattern=/(^|[\s\n]|<br\/?>)(~[\w_]+)/gi;
return text.replace(pattern, "$1<a href='http://tilde.club/$2'>$2</a>");
};
var els = document.getElementsByTagName('p')
for(i = 0;i < els.length; i++) {
els[i].innerHTML = autolink(els[i].innerHTML);
};
})();
@tylerball
tylerball / interlaced.rb
Last active August 29, 2015 14:07
Convert Interlaced JPEGs to Progressive with ImageMagick (...requires ImageMagick)
all_jpegs = Dir.glob('**/*.jpg')
interlaced = []
all_jpegs.each do |f|
is_interlaced = %x(identify -verbose #{f} | grep "Interlace: None")
if is_interlaced.length > 0
puts "Converting #{f}"
interlaced << f
%x(jpegtran -copy all -progressive -outfile #{f} #{f})
end
@tylerball
tylerball / README.md
Last active August 29, 2015 14:10
3d piechart

3d piechart using THREE.js and some lodash.

The Pie constructor takes two arguments, the id of the element to place it and a data object. The data object needs some values:

  • divisions: An array of floats representing their percentage share of the graph. The remainder will be automatically filled.
  • colors: An array of colours. Should be one element longer than divisions to accommodate colouring the remainder.
@tylerball
tylerball / kawaii.py
Created January 20, 2015 20:51
make everyday more kawaii with python and textexpander
#!/usr/bin/python
# coding=utf-8
import random
import sys
faces = [
'(◕‿◕✿)',
'ヽ(‘ ∇‘ )ノ',
'ヾ(@⌒▽⌒@)ノ',
'(◡‿◡✿╰)',
@tylerball
tylerball / cvimrc
Last active August 29, 2015 14:15
cvimrc
let mapleader = ","
map <Leader>x :restore<Space>
map <C-b> :buffer<Space>
@tylerball
tylerball / README.md
Last active August 29, 2015 14:19 — forked from mbostock/.block