Skip to content

Instantly share code, notes, and snippets.

[alias]
up = !sh -c 'git checkout master && git pull && git merge $0 && git push && git checkout $0'
down = !sh -c 'git checkout master && git pull && git checkout $0 && git merge master'
obiekt.tags << %w(szybki wolny 6_cylindrow) # dodawanie
obiekt.tags >> %w(wolny) # usuwanie
obiekt.tags # zwracanie
obiekt.tags=(tags) # przypisanie
szukanie obiektow po tagach, klasa moze byc automatycznym tagiem, jakies zdolnosci specjalne, cos jak duck typing ale bardziej przeszukiwalny itp
cd
mkdir src
cd src
curl -O http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.4.tar.gz
curl -O http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
tar zxf GeoIP-1.4.4.tar.gz
cd GeoIP-1.4.4
./configure --prefix=/opt/GeoIP
make
make check
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script type="text/javascript">
(function($) {
$.fn.at_intervals = function(code, interval) {
return this.each(function() {
var it = this // this is it :)
var interval_id = setInterval(function(){
# Edit ~/.bash_login:
export PATH="$HOME/.rubygems/bin:/opt/local/bin:$PATH"
export GEM_HOME="$HOME/.rubygems/gems"
export RUBYLIB="$HOME/.rubygems/lib"
# Install MacPorts
http://macports.org
# Install Ruby
sudo port install ruby

Note to Self

Be Confident

Tests build confidence. Write 'em. They'll save your ass, and they'll let you take a chainsaw to your code without being afraid of unintended consequences.

Be Lazy

<html>
<head>
<script src="/javascripts/jquery.js" type="text/javascript"></script>
</head>
<body>
<a href="#" id="first">First</a>
<a href="#" id="second">Second</a>
<a href="#" id="third">Third</a>
<script type="text/javascript">
(function($){
$.fn.button = function(){
return this.each(function(){
var e = $(this)
e.bind("on", function(on_event){
e.trigger("before_on", on_event)
if(!on_event.isImmediatePropagationStopped()){
if(!e.data("on")){
e.data("on", true)
e.trigger("toggle", {from: false, to: true})
@ncr
ncr / .bashrc
Created July 8, 2009 22:48 — forked from defunkt/.bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital and @grundprinzip for curl-fu)
function tweet {
curl -n -d status="$*" https://twitter.com/statuses/update.xml --insecure &> /dev/null
echo "tweet'd"
It can be confusing, let me explain it:
When the removed feature was back and I wanted to invoke rake tasks that don't load :environment task (so no masochism) I was getting errors because those tasks treated my slave db as the only db. database.yml looked something like this:
production:
database: slave
master_database:
database: master
So I thought I will try to add slave_database and change the production db to master like this: