This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I thought I needed it, but I didn't need it anymore, | |
// but I already implemented it. So, here we go, if you | |
// ever would need a Javascript camelize implementation | |
// you can freely use this :-). | |
// - [email protected] Tue Feb 15 16:49:52 CET 2011 | |
jQuery.extend (String.prototype, { | |
camelize: function () { | |
return this.replace (/(?:^|[-_])(\w)/g, function (_, c) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Benchmark made easy | |
# | |
# bench { stuff } # runs stuff 1000 times and returns the real time spent doing it | |
# bench(100) { stuff } # as above, but 100 times. | |
# | |
# - [email protected] - public domain | |
module Kernel | |
def bench(n = 1000, &block) | |
raise ArgumentError, 'What should I benchmark?' unless block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ft=ruby | |
# | |
# Usage: | |
# | |
# Save as ./script/service | |
# | |
# Create your ./script/job containing: | |
# | |
# load './script/service' | |
# Service.new do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- lib/sass/tree/visitors/convert.rb.orig 2011-03-20 05:32:23.000000000 +0100 | |
+++ lib/sass/tree/visitors/convert.rb 2011-03-14 14:57:45.000000000 +0100 | |
@@ -21,7 +21,7 @@ | |
def visit_children(parent) | |
@tabs += 1 | |
return @format == :sass ? "\n" : " {}\n" if parent.children.empty? | |
- (@format == :sass ? "\n" : " {\n") + super.join.rstrip + (@format == :sass ? "\n" : " }\n") | |
+ (@format == :sass ? "\n" : " {\n") + super.join.rstrip + (@format == :sass ? "\n" : "\n#{' '*((@tabs-1)*2)}}\n") | |
ensure | |
@tabs -= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
exit 0 if ARGV[0] == ARGV[1] # Not switching branches | |
require 'rubygems' | |
require 'bundler' | |
require 'pathname' | |
root = Pathname(Dir.getwd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Freeze and thaw dyndns zones in order to flush | |
# BIND journal files. | |
# | |
# - vjt Thu May 19 00:34:13 CEST 2011 | |
# | |
ZONES="example.com example.net 3.2.1.in-addr.arpa" | |
for zone in $ZONES; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Highlight HTML elements whose ID is equal to the anchor part of the URL | |
// Tags: dom_id, jQuery, Rails, Javascript | |
// | |
$(function () | |
if (/^#(\w+_)+\d+$/.test (document.location.hash)) { | |
var element = $(RegExp.lastMatch); | |
element.css ({backgroundColor: '#ffffd7'}).highlight (); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'zip/zipfilesystem' | |
file = ARGV[0] or abort("Usage: #$PROGRAM_NAME <file.docx>") | |
Zip::ZipFile.open(file) do |zip| | |
doc = Nokogiri::XML(zip.file.read('word/document.xml')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration suitable to display Apache/nginx access logs | |
# Based on conf.proftpd by Pavol Domin | |
# Crafted by Marcello Barnaba <[email protected]> | |
# Get GRC at http://kassiopeia.juls.savba.sk/~garabik/software/grc.html | |
# | |
# ip number | |
regexp=^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} | |
colours=bold magenta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# IDE Session starter - you should save this script as ~/bin/session, make it | |
# executable with chmod +x ~/bin/session, and then make a symlink to it for | |
# every application you want to start. | |
# E.g. ln -s session ~/bin/members creates a "members" symlink, and when you'll issue | |
# "members" on the command line this script will: | |
# Check if a tmux session named "members" exists |