Skip to content

Instantly share code, notes, and snippets.

@tadejm
tadejm / test.rb
Created November 22, 2013 16:14
question
class Person
include UsersAdditions
end
module UsersAdditions
def full_name
"#{first_name} #{last_name}"
end
end
# test.csv
#
# A,B,"C D"
# 1,2,"3 4"
# 5,6,7
import csv
ifile = open('test.csv', "rb")
reader = csv.reader(ifile)
@tadejm
tadejm / spork.diff
Last active December 28, 2015 09:59 — forked from anonymous/-
diff --git a/Guardfile b/Guardfile
index 8382d1c..5009879 100644
--- a/Guardfile
+++ b/Guardfile
@@ -9,16 +9,10 @@ guard 'spork', :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
- watch(%r{features/support/}) { :cucumber }
- watch(%r{^app/models/.+\.rb$})
@tadejm
tadejm / commute_time.rb
Last active December 26, 2015 22:19
In order to calculate commute time from a given property to work, I created this script, which copies Spareroom property lat,lng system clipboard. Works on os x only. Usage: ruby commute_time.rb -i SPAREROOM_PROPERTY_ID
require "open-uri"
require "nokogiri"
require "optparse"
BASE_URI = "http://www.spareroom.co.uk/flatshare/flatshare_detail.pl?flatshare_id="
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: #$0 -i ROOMID"
Be An Executioner
It's so funny when I hear people being so protective of ideas. (People who want me to sign an nda to tell me the simplest idea.)
To me, ideas are worth nothing unless executed. They are just a multiplier. Execution is worth millions.
Explanation:
Awful idea = -1
Weak idea = 1
[user]
name = Tadej Murovec
email = [email protected]
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
Options +FollowSymlinks
Options All -Indexes
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(robots\.txt|favicon\.ico|sitemap\.xml)$
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain/$1 [R=301,L]
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^(([^/]+/)*[^./]+)/?$ /$1.html [L]
# added some useful methods to Array class
class Array
def sum
self.inject{ |sum,x| sum ? sum + x : x }
end
end
# counts conflicts at current seat order
def conflicts(order, hates)
conflict = 0
order.each do |table|
# added some useful methods to Array class
class Array
def sum
self.inject{ |sum,x| sum ? sum + x : x }
end
end
# counts conflicts at current seat order
def conflicts(order, hates)
conflict = 0
order.each do |table|
/* Userscript, fluid, finance.si */
* { border: 0 none !important; border-spacing: 0px 0px !important; }
* body { background-color: rgb(254, 237, 228) !important; line-height: 1.5em !important; }
ul{ list-style: none !important;}
#siteHeader,#miniprint{ display: none !important; }
.siteContentPad{ height: 1em !important; display: none; }
.right, .footer, .article-source, .ad, .sitemap, .sub-column, .pr-title, .art-rubrika{ display: none; }
tr.title{ display: none; }
#article-source{ display: none; }
#maincolumn{ width: 100% !important; }