Skip to content

Instantly share code, notes, and snippets.

View sidonath's full-sized avatar
🐈
Petting cats

Damir Zekic sidonath

🐈
Petting cats
View GitHub Profile
#!/usr/bin/env ruby
require 'rubygems'
require 'osax'
require 'maruku'
doc = Appscript.app('WriteRoom').documents[0]
path = doc.file.get.path
file = File.join(
# Append to ~/.profile (or ~/.bashrc)
# append to history, not overwrite
shopt -s histappend
# append command to history file before it's executed
export PROMPT_COMMAND="history -a"
# ignore duplicate consecutive commands
export HISTCONTROL=ignoreboth
# thanks to:
# http://www.linuxforums.org/forum/linux-programming-scripting/109516-retaining-bash-history-all-sessions.html
# copy to your Capistrano recipe file
namespace :deploy do
task :clear_cached_assets, :roles => :web do
dir = "#{current_release}/public"
run %(rm #{dir}/javascripts/all.js #{dir}/stylesheets/master.css)
end
end
@sidonath
sidonath / singleton.js
Created June 6, 2009 07:52
Another take on singleton pattern in JavaScript
function singleton(self, wrapper, ctor) {
// support for early failing
if (self instanceof wrapper) {
throw wrapper.name + " " +
"is a singleton, you cannot create its instance. " +
"To get the isntance: " + wrapper.name + "();";
}
if (!ctor) {
return;
# this goes in the $HOME dir
# needs mislav-rspactor v0.3.1 and RSpec 1.2
Runner.class_eval do
class << self
alias old_formatter_opts formatter_opts
def formatter_opts
old_formatter_opts + " -r /Users/mislav/Projects/unicode_formatter -f UnicodeFormatter"
end
end
@sidonath
sidonath / gist:58895
Created February 5, 2009 18:21 — forked from pete/gist:57898
Experiments in revision control: Curry recipe.
My personal recipe for Japanese curry, which has mutated over the years and is
now open-source thanks to github, hot damn. Some of the ingredients are not
very Japanese, but curry came to Japan from England which got it from India to
begin with, so whatever.
1.5 - 2 lbs. of meat, prefer thin-sliced beef (komagire), pork works, too.
Thin-sliced stuff is always best, but in a pinch stewing beef works. Bacon
works surprisingly well. Chicken will work, technically, but if you must,
// ==UserScript==
// @name twitter Komplimenti
// @namespace http://z3c.info/
// @description Daje komplimente korisniku
// @include http://twitter.com/home
// ==/UserScript==
$ = unsafeWindow.jQuery;
var MessageProvider = new (function () {
// ==UserScript==
// @name questionablecontent.net RSS text
// @namespace http://z3c.info/
// @description Displays text from RSS feed below the comic
// @include http://www.questionablecontent.net/
// @include http://www.questionablecontent.net/index.php
// @include http://www.questionablecontent.net/view.php?comic=*
// @include http://questionablecontent.net/
// @include http://questionablecontent.net/index.php
// @include http://questionablecontent.net/view.php?comic=*
// ==UserScript==
// @name twitter Search v2
// @namespace http://z3c.info/
// @description Adds a search field to the Twitter interface
// @include http://twitter.com/home
// ==/UserScript==
// Twitter Search script
// version 0.3
// 2009-01-31
// ==UserScript==
// @name last.fm About Me Preview
// @namespace http://z3c.info/
// @description Displays the Preview button when editing "About You" section in user settings
// @include http://www.last.fm/settings
// @include http://www.lastfm*/settings
// ==/UserScript==
$ = unsafeWindow.$;
$$ = unsafeWindow.$$;