Skip to content

Instantly share code, notes, and snippets.

Miha Rekar mrfoto

Block or report user

Report or block mrfoto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mrfoto / quotes.json
Last active Aug 4, 2019
Stoic Quotes JSON
View quotes.json
{"quotes":[{"text":"If anyone tells you that a certain person speaks ill of you, do not make excuses about what is said of you but answer, \"He was ignorant of my other faults, else he would not have mentioned these alone.","author":"Epictetus"},{"text":"Wealth consists not in having great possessions, but in having few wants.","author":"Epictetus"},{"text":"Don't explain your philosophy. Embody it.","author":"Epictetus"},{"text":"There is only one way to happiness and that is to cease worrying about things which are beyond the power or our will.","author":"Epictetus"},{"text":"Man is not worried by real problems so much as by his imagined anxieties about real problems","author":"Epictetus"},{"text":"Don't just say you have read books. Show that through them you have learned to think better, to be a more discriminating and reflective person. Books are the training weights of the mind. They are very helpful, but it would be a bad mistake to suppose that one has made progress simply by having internalized their
mrfoto / quotes.rb
Last active Apr 27, 2019
Stoic quotes from Goodreads
View quotes.rb
require 'rubygems'
require 'bundler'
require 'concurrent'
require 'open-uri'
require 'json'
class QuoteDownloader
attr_reader :author
mrfoto / Gemfile
Last active Jan 28, 2019
UPN QR to N26 and Toshl
View Gemfile
# frozen_string_literal: true
source ''
gem 'sinatra'
gem 'twentysix'

Keybase proof

I hereby claim:

  • I am mrfoto on github.
  • I am mrfoto ( on keybase.
  • I have a public key ASDp0tVgbAAvCb6AhVTYz1XosMop3buoiYMiEeOqm2qpnAo

To claim this, I am signing this object:

mrfoto / iTerm2-ssh.zsh
Last active Apr 12, 2018
Change iTerm 2 profile and tab color when SSH-ing
View iTerm2-ssh.zsh
if [[ -n "$ITERM_SESSION_ID" ]]; then
function change-tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
echo -ne "\033]6;1;bg;blue;brightness;$3\a"
function change-profile() {
echo -ne "\033]50;SetProfile=$1\a"
mrfoto / benchmark.rb
Created Aug 27, 2015
attr_reader vs instance var
View benchmark.rb
require 'benchmark/ips'
class Foo
attr_reader :test
def initialize(test)
@test = test
def read

Keybase proof

I hereby claim:

  • I am mrfoto on github.
  • I am mrfoto ( on keybase.
  • I have a public key whose fingerprint is 7FD4 67EF A492 70FF C6B4 14DF 7091 E70A 0FF2 C657

To claim this, I am signing this object:

mrfoto / query.rb
Last active Aug 29, 2015
Most followed user
View query.rb
# Is there a better way to do this? I have User model
.with('u, COUNT(n) AS c')
.return('u, c')
.order('c DESC')
.where('c > 2').to_a
# Additionaly I want to remove some users %w(mrfoto mfilej otobrglez) for example
# I came up with this but I'm wondering if there's a better way?
mrfoto / flatten_vs_array.rb
Last active Aug 29, 2015
[].flatten(1) vs Array()
View flatten_vs_array.rb
require 'benchmark/ips'
Benchmark.ips do |x|
class SingleFilterClass
def initialize(method, values)
@method = method
@values = values
def call_flatten(value)
mrfoto / struct_vs_class.rb
Created Mar 6, 2015
Ruby: Struct vs Class performance
View struct_vs_class.rb
require 'benchmark/ips'
Benchmark.ips do |x|
SingleFilterStruct =, :values) do
def call(value)
Array(value).any? { |v| v.send(method, *values) }
class SingleFilterClass
You can’t perform that action at this time.