Skip to content

Instantly share code, notes, and snippets.

-- either add to the clientkeys or add to rc.lua at the end
clientkeys = awful.util.table.join(clientkeys,
awful.key({ modkey, }, "s", function (c) c.ontop = not c.ontop end ),
awful.key({ modkey, }, "s", function (c) c.sticky = not c.sticky end ),
)
<?php
/*
* Extended Doctrine Query class providing a few additional functions
* for wrapping your where clauses more efficiently
*/
class Doctrine_Query_Extra extends Doctrine_Query
{
protected $_startClause = false;
/**
jQuery(document).ready(function($){
$(document).ajaxError(function(e, xhr, settings, exception) {
//if the status of an ajax call is 401 reload the page
//depending on you requirements you can specify window.location = http://...
if(xhr.status == 401){
window.location.reload() ;
}
});
});
padsp /opt/java/jre/bin/java -Dslimserver=127.0.0.1 -Dskins=headless -jar SoftSqueeze.jar
@kabturek
kabturek / lillypad.sh
Created July 14, 2011 11:18
Burning the lillypad bootloader
#arduino/hardware/arduino/bootloaders/lilypad
#these fuses are for the lilypad with atmega 168! for other chips see arduino/hardware/arduino/boards.txt
avrdude -c usbtiny -p m168 -B 5 -V -e -U lock:w:0x3F:m -U hfuse:w:0xdd:m -U lfuse:w:0xe2:m -U efuse:w:0x00:m
avrdude -c usbtiny -p m168 -B 1 -V -D -U flash:w:LilyPadBOOT_168.hex:i
avrdude -c usbtiny -p m168 -B 5 -V -U lock:w:0x0F:m
@kabturek
kabturek / .bashrc
Created September 21, 2011 20:17
Getting vim/gvim to work with other ruby versions than the one that is compiled with. (when using it with vim from ubuntu repos - compiled againt ruby1.8 with rvm using 1.9.2)
gvim()
{
(unset GEM_PATH GEM_HOME; command gvim "$@")
}
vim()
{
(unset GEM_PATH GEM_HOME; command vim "$@")
}
@kabturek
kabturek / run_tags.rb
Created November 16, 2011 21:55 — forked from tobias/run_tags.rb
A script for generating TAGS from a git hook.
#!/usr/bin/env ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'
@kabturek
kabturek / .osx
Created April 17, 2012 12:45
OSX configuration
# Disable menu bar transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
@kabturek
kabturek / google_bot_aware.rb
Created May 18, 2012 11:11 — forked from rchampourlier/google_bot_aware.rb
Rack middleware to make Rails deal correctly with GoogleBot's '*/*;q=0.6' Accept header
# This Rack middleware helps solving the issue with some Rails versions which do not accept
# a '*/*;q=0.6' and their variants 'Accept' request header. This header is particularly used
# by Google Bot, and if Rails doesn't like it, it will return a 500 or 406 error to Google Bot,
# which is not the best way to get your pages indexed.
#
# References:
# - http://stackoverflow.com/questions/8881756/googlebot-receiving-missing-template-error-for-an-existing-template
# - https://github.com/rails/rails/issues/4127
#
class GoogleBotAware
@kabturek
kabturek / check_yml_files.rb
Created July 18, 2012 08:13
Simple script to check yml files
#!/usr/bin/env ruby
# encoding: utf-8
require 'yaml'
YAML::ENGINE.yamler = 'psych' # or 'syck' for old parser
d = Dir["./**/*.yml"]
d.each do |file|
begin
puts "checking : #{file}"