Skip to content

Instantly share code, notes, and snippets.

@lackac
lackac / typocomments2disqus.rb
Created November 19, 2009 16:30
Migrates a blog's comments from the Typo blog engine to Disqus
#!/usr/bin/env ruby
# Author: László Bácsi <[email protected]>
require 'rubygems'
require 'httparty'
require 'json'
require 'sequel'
require 'htmlentities'
@lackac
lackac / README.md
Created December 13, 2009 12:20
Bookmarklet or Greasemonkey script to keep record of your favorite Ruby5 stories

/*

Ruby5 Favorites

You can use this script to keep record of your favorite stories from Ruby5. The script will show a star icon next to eacy story title on Ruby5 episode pages through which you can mark those stories as favorites. It also shows a nice list of your marked stories in the top right section of the webpage. The script works as a userscript and it can work through a bookmarklet too. I have tested it with Firefox 3.5, Safari 4.0.4 and Google Chrome 4.0.249.30.

Install as a User Script

If you have Greasemonkey (or GreaseKit in case of Safari) installed, open the raw version of the ruby5_favorites.user.js file in this gist in your browser and follow the instructions. Each time you visit Ruby5 after you have installed the script your favorites will appear and you can mark stories as favorites on each episode page.

Install as a Bookmarklet

@lackac
lackac / release_payment.user.js
Created March 8, 2010 13:47
GM script for Pivotal Tracker to calculate payment for each release by accumulating points and hours above it.
// ==UserScript==
// @name Release payment
// @namespace http://lackac.hu
// @description Calculates payment for each release by accumulating points and hours above it.
// @include https://www.pivotaltracker.com/projects/*
// ==/UserScript==
var POINT_RATE = 12000, HOURLY_RATE = 6000, CURRENCY = '% Ft';
@lackac
lackac / googler.rb
Created March 16, 2010 15:02
4. gyakorlat – Googler feladat megoldás
require 'rubygems'
require 'nokogiri'
require 'uri'
require 'open-uri'
print "Mi a neved? "
query = gets.chomp
uri = "http://www.google.com/search?q=#{URI.encode(%{"#{query}"})}"
# puts uri
@lackac
lackac / googler.rb
Created March 18, 2010 13:26
5. gyakorlat – Googler Sinatra-val
require 'rubygems'
require 'nokogiri'
require 'uri'
require 'open-uri'
require 'sinatra'
get '/search/:query' do
html = "<pre>"
doc = Nokogiri::HTML(open("http://www.google.com/search?q=#{URI.encode(%{"#{params[:query]}"})}"))
doc.css(".g").each do |hit|
@lackac
lackac / imstatus
Created March 19, 2010 10:57
Simple ruby script to set iChat/Adium/Skype status and status message
#!/usr/bin/env ruby
#
# Update iChat/Adium/Skype status
#
# USAGE: imstatus <online|available|offline|away|dnd|invisible> [message]
# (supports partial status identifiers like 'on' or 'aw')
#
# László Bácsi <[email protected]>
# http://github.com/lackac
@lackac
lackac / xkcd_title.user.js
Created April 1, 2010 16:37
Adds a title command to the xkcd.com's cli which prints the last comic's title. It's a Greasemonkey script, use the raw version and it installs if you have Greasemonkey/GraseKit.
// ==UserScript==
// @name XKCD title command
// @namespace http://icanscale.com
// @description Adds a title command to the cli which prints the last comic's title
// @include http://xkcd.com/*
// ==/UserScript==
(function() {
if (typeof unsafeWindow == 'undefined') {
var unsafeWindow = window; // for being able to use this as a bookmarklet
function pickler {
local original_rvm=$(rvm-prompt i v p g)
rvm use 1.8.7@pickler
/usr/bin/env pickler "$@"
rvm use $original_rvm
}
/usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:62:in `method_missing': Cannot find IncludeAttribute for include_attribute (NameError)
Original exception: NameError: uninitialized constant Chef::Resource::IncludeAttribute
from /srv/chef/cache/cookbooks/chef/recipes/server_proxy.rb:26:in `from_file'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/cookbook.rb:171:in `load_recipe'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/mixin/language_include_recipe.rb:38:in `include_recipe'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/mixin/language_include_recipe.rb:26:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/mixin/language_include_recipe.rb:26:in `include_recipe'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/compile.rb:145:in `load_recipes'
from /usr/local/lib/ruby/gems/1.8/gems/chef-0.8.16/bin/../lib/chef/compile.rb:144:in `each'
from /usr/local
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>(Really Stupid) Munchkin Counter</title>
<style type="text/css" media="screen">
body {
font-family: Helvetica;
}