Skip to content

Instantly share code, notes, and snippets.

View mfilej's full-sized avatar

Miha Filej mfilej

View GitHub Profile
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 June 19, 2018 07:24
Kent Beck: Mastering Programming

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.

(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
#!/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
#!/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
#!/usr/bin/env ruby
# Assumes `psql` is able to run without additional arguments on your machine.
# This usually means you need to have a database name that matches your
# username.
Prefixes = %w[k M G]
Prefix = Struct.new :to_s do
def <=>(other)
[INTERNAL_GEAR_2]
VALUE=0
[INTERNAL_GEAR_3]
VALUE=2
[INTERNAL_GEAR_4]
VALUE=4
[INTERNAL_GEAR_5]
VALUE=10
[INTERNAL_GEAR_6]
defmodule Ploy.Task do
use GenEvent
def start do
result = {:ok, pid} = GenEvent.start_link([])
GenEvent.add_handler(pid, Ploy.Task, [])
result
end
def run(pid) do
@mfilej
mfilej / youtube.applescript
Created February 6, 2015 21:54
Open YouTube video in current tab with QuickTime
tell application "Safari"
set youtubeURL to URL of current tab of window 1
end tell
-- set format to item 1 of (choose from list {"22/18", "18"})
set format to "22/18"
set youtubeCmd to "/usr/local/bin/youtube-dl -g -f " & format & " --no-playlist '" & youtubeURL & "'"
set videoURL to do shell script youtubeCmd
tell application "QuickTime Player" to open URL videoURL
class ApiError < StandardError
def self.build(status:, message:, key:)
Class.new(self) do
define_method(:status) { status }
define_method(:message) { message }
define_method(:key) { key }
end
end
end