Skip to content

Instantly share code, notes, and snippets.

Jesper Rønn-Jensen jesperronn

View GitHub Profile
View cucumbertables.vim
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
View convert_encoding.rb
#!/usr/bin/env ruby -KU
require 'optparse'
require 'ostruct'
require 'iconv'
SCRIPT_NAME = "File Character Encoding Converter"
class FileEncodingConverterOptionParser
View screenshots.rb
# This is an example of how you can set up screenshots for your
# browser testing. Just run cucumber with --format html --out report.html
module Screenshots
def embed_screenshot(id)
%x(scrot #{$ROOT_PATH}/images/#{id}.png)
cowboy /
Last active Jul 29, 2020
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
View git-grep-submodule
git --no-pager grep "$@"
git --no-pager submodule --quiet foreach 'git grep --full-name -n ' "$@" '; true'
benedikt / rails.rb
Created Jul 30, 2011
Capistrano task to open a rails console on a remote server. Require this file in your deploy.rb and run "cap rails:console"
View rails.rb
# encoding: UTF-8
Capistrano::Configuration.instance(:must_exist).load do
namespace :rails do
desc "Open the rails console on one of the remote servers"
task :console, :roles => :app do
hostname = find_servers_for_task(current_task).first
exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'"
benjchristensen / index.html
Created Aug 9, 2011
Simple Sparkline using SVG Path and d3.js
View index.html
<title>Simple Sparkline using SVG Path and d3.js</title>
<script src=""></script>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
jpmckinney / twitter-bootstrap-ie6.scss
Created Nov 14, 2011
SCSS additions to make Twitter Bootstrap work in IE6
View twitter-bootstrap-ie6.scss
// Assumes you are using <html> conditional classes as described here:
.lt-ie7 {
// blockquote small:before{content:'\2014 \00A0';}
blockquote small:before{content:"";}
// [class*="span"]{display:inline;float:left;margin-left:20px;}
pcreux / helper_steps.rb
Created Jan 23, 2012
Cucumber step to match tables
View helper_steps.rb
module TableMatchHelper
# @param table [Array[Array]]
# @param expected_table [Array[Array[String]]]
# The expected_table values are String. They are converted to
# Regexp when they start and end with a '/'
# Example:
# assert_table_match(
# [["Name", "Date"], ["Philippe", "Feb 08"]],
# [["Name", "Date"], ["Philippe", "/\w{3} \d{2}/"]]
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "";
parser.protocol; // => "http:"
parser.hostname; // => ""
parser.port; // => "3000"
parser.pathname; // => "/pathname/"; // => "?search=test"
parser.hash; // => "#hash"; // => ""
You can’t perform that action at this time.