Skip to content

Instantly share code, notes, and snippets.

Avatar

Miha Filej mfilej

View GitHub Profile
View Fonts.brewfile
tap 'homebrew/cask-fonts'
cask 'font-fira-code'
cask 'font-ibm-plex-mono'
cask 'font-source-code-pro'
cask 'font-monoid'
cask 'font-hack'
cask 'font-iosevka'
cask 'font-jetbrains-mono'
cask 'font-fantasque-sans-mono'
View keybase.md

Keybase proof

I hereby claim:

  • I am mfilej on github.
  • I am mfilej (https://keybase.io/mfilej) on keybase.
  • I have a public key ASCboF-9E1U4DHRT6NPu2bHMtoJGwlCfzBCe32GI28bM3Ao

To claim this, I am signing this object:

View resque.rake
namespace :resque do
desc "Clear resque queues"
task clear: :environment do
abort "Can not run outside of development env" unless Rails.env.development?
queues = Resque.queues
queues.each do |queue_name|
puts "Cleaning #{queue_name}..."
Resque.redis.del "queue:#{queue_name}"
end
@mfilej
mfilej / direnvrc.sh
Last active Aug 1, 2018
Switch ruby versions with direnv
View direnvrc.sh
source /usr/local/opt/chruby/share/chruby/chruby.sh
# Uncomment to use with rubies installed with ruby-build:
# RUBIES+=(~/.rbenv/versions/*)
# use ruby [version]
use_ruby() {
local ver=$1
if [[ -z $ver ]] && [[ -f .ruby-version ]]; then
ver=$(cat .ruby-version)
View gist:c151b708f95a3fb62592245d27fce679
=> [ConferenceSession,
Mongoid::Timestamps::Short,
Mongoid::Timestamps::Updated,
Mongoid::Timestamps::Updated::Short,
Mongoid::Timestamps::Timeless,
Mongoid::Timestamps::Created,
Mongoid::Timestamps::Created::Short,
Mongoid::Document,
Mongoid::QueryCache::Document,
Kaminari::Mongoid::MongoidExtension::Document,
View gist:24123fe09db8bbfb81ee54502d485da6
foone (@Foone): You want to know something about how bullshit insane our brains are?
OK, so there's a physical problem with our eyes: We move them in short fast bursts called "saccades", right? very quick, synchronized movements.
The only problem is: they go all blurry and useless during this
foone (@Foone): having your vision turn into a blurry mess every time you move your eyes is obviously not a good idea, so our brains hide it from us. Now, imagine you're an engineer and you have this problem.
foone (@Foone): You've got some obvious solutions you could do.
1. make the vision go black during movement. (Some VR games do this!)
2. just keep showing the last thing we saw prior to movement
@mfilej
mfilej / kent-beck-mastering-programming.md
Created Jun 19, 2018
Kent Beck: Mastering Programming
View kent-beck-mastering-programming.md

Mastering Programming

[Source][].

From years of watching master programmers, I have observed certain common patterns in their workflows. From years of coaching skilled journeyman programmers, I have observed the absence of those patterns. I have seen what a difference introducing the patterns can make.

Here are ways effective programmers get the most out of their precious 3e9 seconds on the planet.

The theme here is scaling your brain. The journeyman learns to solve bigger problems by solving more problems at once. The master learns to solve even bigger problems than that by solving fewer problems at once. Part of the wisdom is subdividing so that integrating the separate solutions will be a smaller problem than just solving them together.

View gist:f7976918cefc4ea2549addc14740ba5c
(Backtrace restricted to imported tasks)
cap aborted!
TrackerApi::Error: {:status=>403, :headers=>{"Access-Control-Allow-Credentials"=>"false", "Access-Control-Allow-Headers"=>"X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is", "Access-Control-Allow-Methods"=>"GET, POST, PUT, DELETE, OPTIONS", "Access-Control-Allow-Origin"=>"*", "Cache-Control"=>"no-cache", "Content-Type"=>"application/json; charset=utf-8", "Date"=>"Tue, 08 May 2018 09:46:15 GMT", "Server"=>"nginx + Phusion Passenger", "Status"=>"403 Forbidden", "Strict-Transport-Security"=>"max-age=31536000; includeSubDomains; preload", "X-Content-Type-Options"=>"nosniff, nosniff", "X-Frame-Options"=>"SAMEORIGIN", "X-Powered-By"=>"Phusion Passenger Enterprise", "X-Request-Id"=>"af85633a-7fbe-4339-aa73-e1f27f1d4d10", "X-Runtime"=>"0.010645", "X-Tracker-Client-Pinger-Interval"=>"20", "X-Vcap-Request-Id"=>"c5e8215b-8bf5-4b3a-5d33-596f9627995b", "X-Xss-Pr
View aoc16_2_2.exs
#!/usr/bin/env elixir
defmodule Keypad do
def decode(input) do
String.splitter(input, "\n")
|> Enum.map_reduce(5, fn input_line, key ->
new_key = follow(input_line, key)
{new_key, new_key}
end)
end
View aoc16_2_1.exs
#!/usr/bin/env elixir
defmodule Keypad do
def decode(input) do
String.splitter(input, "\n")
|> Enum.map_reduce(5, fn input_line, key ->
new_key = follow(input_line, key)
{new_key, new_key}
end)
end