Skip to content

Instantly share code, notes, and snippets.

@paneq
paneq / a.rb
Last active December 15, 2015 04:50
Dunno what I want to show
class Post
after_create do
Twitter.add_to_stream(self.title)
end
end
@paneq
paneq / brain.md
Last active December 15, 2015 01:09
Wywód o walidacji

O walidacjach AR i ich problemach

Wstęp

Załóżmy, że mamy do zaimplementowania delegowanie jakiejś sprawy między dwoma współpracownikami. Reguła biznesowa jest taka, że użytkownicy muszą pełnić tą samą rolę by oddelegować do kogoś zadanie.

To jest nasz punkt wyjścia. Dyskusyjne rozwiązanie ale przyjmijmy, że działa.

class Delegation < ActiveRecord::Base
@paneq
paneq / a.txt
Last active December 14, 2015 21:28
SQL optymalizacja
Znajdź dla każdego ze studentów 1,2,3,4 osobno
taki ich rekord LPL, który został stworzony jako
ostatni przed dniem 2013-02-28
@paneq
paneq / cmp_tuples.rb
Created March 4, 2013 09:41
cmp_tuples beautiful code
# Compare the attributes for each Tuple
#
# @param [Tuple] left
# @param [Tuple] right
#
# @return [-1]
# returned if the left should be sorted before the right
#
# @return [0]
# returned if the left and right are equal
@paneq
paneq / pitch.md
Last active December 13, 2015 23:19
Muon pitch

Muon

Not comfortable with your current time tracking tool ? Expecting something better ? Faster, easier, less fancy but more effective ? Muon might be for you

Muon is a commandline tool

$ cd project/
$ muon init
@paneq
paneq / bash.log
Last active December 12, 2015 09:48
Postgres super simple config for DEVELOPMENT mode. Never use it in production !!! It allows you to connect from localhost without using passwords. Very convenient.
# Make yourself superuser so that you can create and destroy databases without hassle. With power comes responsibility.
[username] $ sudo su postgres
[postgres] $ createuser -s username
@paneq
paneq / app.rb
Created February 5, 2013 11:01
gli 2 hack for supporting multiple usage of same switch
#!/usr/bin/env ruby
require 'gli'
include GLI::App
AsdMulti = Object.new
asd = []
accept(AsdMulti) do |value|
asd << value
asd
@paneq
paneq / host.log
Created January 30, 2013 13:19
avahi
[rupert] 14:18 <1.9.3p194> ~/develop/pons-kitchen (master) > ping proxy.pons.local
PING proxy.pons.local (172.26.0.103) 56(84) bytes of data.
64 bytes from proxy.real.pons.local (172.26.0.103): icmp_req=1 ttl=64 time=0.149 ms
@paneq
paneq / Vagrantifle.rb
Created January 24, 2013 15:32
Vagrant SSH downloader
module Vagrant
module Downloaders
class SSH < Base
def self.match?(uri)
URI(uri).scheme == "ssh"
rescue => x
false
end
def download!(source_url, destination_file)