Skip to content

Instantly share code, notes, and snippets.

View tagowalne obiekty w progrmowaniu
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
View .gitconfig
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'
View How to install geoip_city gem on Mac
mkdir src
cd src
curl -O
curl -O
tar zxf GeoIP-1.4.4.tar.gz
cd GeoIP-1.4.4
./configure --prefix=/opt/GeoIP
make check
View example.html
<script type="text/javascript" src=""></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(){
View gist:38795
# 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
# Install Ruby
sudo port install ruby
View think.markdown

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

View jquery.custom_events.js
$.fn.button = function(){
return this.each(function(){
var e = $(this)
e.bind("on", function(on_event){
e.trigger("before_on", on_event)
if(!"on")){"on", true)
e.trigger("toggle", {from: false, to: true})
View jquery plugin template
<script src="/javascripts/jquery.js" type="text/javascript"></script>
<a href="#" id="first">First</a>
<a href="#" id="second">Second</a>
<a href="#" id="third">Third</a>
<script type="text/javascript">
View .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="$*" --insecure &> /dev/null
echo "tweet'd"
View gist:147870
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:
database: slave
database: master
So I thought I will try to add slave_database and change the production db to master like this: