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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
OlderNewer