Skip to content

Instantly share code, notes, and snippets.

@joerixaop
joerixaop / README.md
Last active August 29, 2015 14:10 — forked from botandrose/README.md
@joerixaop
joerixaop / application.js
Created September 4, 2011 21:53 — forked from spint/application.js
Build up jQuery-UI dialogs on the fly
// Creates a jQuery UI dialog on the fly, every time a link .user-link is clicked,
// dialog content will be loaded from the url specified by the clicked link
$(function(){
$(".user-link").live('click', function(){
var link = $(this);
$("<div><img src='" + BASEPATH + "images/small-spinner.gif' /> </div>")
.dialog({
autoOpen: true, //for info, true is default
modal: true,
@joerixaop
joerixaop / gist:811139
Created February 4, 2011 14:03
Git post commit hook to remind me not to add console.log statements
​​#!/bin/sh
# Detects a forgotten console.log statement
# Could be made a pre-commit hook forcing the issue, but then adding jQuery.js becomes cumbersome
if $(git show HEAD | grep -q '^\+.*console\.log')
then
RED='\e[1;31m'
NC='\e[0m'
echo -e "${RED}WARNING:${NC}"
echo " You left in a console.log statement in your code, please reconsider commiting this"
# this only gets cached in @admin if true
# how to cache this also in case of false?
def admin?
@admin ||= has_role? 'admin'
end
#is the following ok?
class LowCoverReport < ActiveRecord::Base
# The other solution would fail for an empty list of countries
# If you don't need it you also can leave out the class variable
country_query = lambda{|o| {:conditions => ["country_id IN (?)", o.countries]} }
named_scope :for_user, country_query
named_scope :for_session, country_query
@joerixaop
joerixaop / gist:706314
Created November 19, 2010 10:12
Notes on Rubyconf ninja git training
word diffing:
git diff --word-diff
Slides presentation: http://git-tips.heroku.com/ <- no ninja's inside :-(
Useful commands:
git log --decorate --oneline --graph
git bundle # Especially useful for VPN etc.
Branches + merging: