Skip to content

Instantly share code, notes, and snippets.

<h1>All Subscribers</h1>
<ul>
<li>
<strong>Mike Tierney</strong>
<span class="sub-since">Subscriber Since 2012/11/04</span>
</li>
<li>
<strong>Martin Arrowsmith</strong>
function! MyFoldText() " {{{
let line = getline(v:foldstart)
" so that it works when relativenumber has been set
if (&relativenumber)
let nucolwidth = &fdc + &relativenumber * &numberwidth
else
let nucolwidth = &fdc + &number * &numberwidth
endif
@miketierney
miketierney / content_for.php
Created June 29, 2012 18:10
content_for and yield in php (specifically wordpress)
<?php
/**
* A simple `content_for` and `yield` function to make it easier to run custom JS and CSS
* in the context of templates. Works like the Rails methods of the same name.
*
* Requires PHP 5.3 or higher (it uses closures, which were added in 5.3)
* Original Source: http://autonomousmachine.com/posts/2010/6/4/a-simple-content_for-in-php
*
* Usage:
*
<div class="buttons group">
<button><span>Button Text</span></button>
</div>
@miketierney
miketierney / gist:1299678
Created October 19, 2011 21:07
Some nice javascript string manipulations
/**
* Takes a string and capitalizes the first letter.
*
* @example
* "this is an all lower-case string".capitalize();
* // => "This is an all lower-case string"
*
* @return String
**/
String.prototype.capitalize = function(){
@miketierney
miketierney / .janus.rake
Created July 27, 2011 13:59
Janus configuration files
skip_vim_plugin "taglist"
vim_plugin_task "zencoding", "https://github.com/mattn/zencoding-vim.git"
vim_plugin_task "tagbar", "https://github.com/majutsushi/tagbar.git"
vim_plugin_task "scratch", "https://github.com/vim-scripts/scratch.vim.git"
vim_plugin_task "easymotion", "https://github.com/Lokaltog/vim-easymotion.git"
@miketierney
miketierney / clouds.vim
Created March 24, 2011 00:21
A Vim port of Fred Leblanc's Clouds Textmate theme.
" Vim color file
" Converted from Textmate theme Clouds using Coloration v0.2.5 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@miketierney
miketierney / contextmenuevent.js
Created February 3, 2011 22:13
Some jQuery code that will capture a contextmenu event
// not sure how bulletproof this is, and you have to promise to only use this for good and never for evil.
$(document).bind("contextmenu", function(e) {
e.preventDefault();
alert("Contextmenu!");
});
@miketierney
miketierney / dsdontwritenetworkstores.bash
Created January 12, 2011 00:34
Keeps Mac OSX from writing the annoying ._ files to remote volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
@miketierney
miketierney / Console_Progress_Bar.rb
Created December 22, 2010 21:12
A CLI-style progress bar
# Original credit goes to Aaron Patterson (@tenderlove) for posting the following to Twitter (http://pnpnt.me/2m):
# i = 0; while i <= 15; print "[#{'=' * i}#{' ' * (15 - i)}] #{((i/15.0) * 100).round}%\r"; i += 1; sleep 0.2; end; puts
# Apparently he borrowed this from Yehuda Katz (@wycats) -- http://pnpnt.me/2n.
# And then to Magnus Holm (@judofyr) for pointing out that Range#each could work (he actually references Range#map, too, but I'm not using that here). -- http://pnpnt.me/2o
#
# TODO: Figure out a more succinct way of doing this (more Ruby-esque, less JS-esque).
(0..15).each { |i| print "[#{'=' * i}#{' ' * (15 - i)}] #{((i/15.0) * 100).round}%\r"; sleep 0.2; }; puts