Skip to content

Instantly share code, notes, and snippets.

View mackuba's full-sized avatar
🌤️
Playing with Bluesky API

Kuba Suder mackuba

🌤️
Playing with Bluesky API
View GitHub Profile
@mackuba
mackuba / nsconference_2014.md
Last active August 29, 2015 13:58
Notes from NSConference 6 (Leicester, 2014)

NSConference 6 notes

Day 1

How to lose at poker (Mike Lee, @bmf)

  • emotion/intuition vs. reason in cards - those who ultimately win are not those who follow their intuition and emotions, but those who resist the temptation to do that; e.g. an "inside straight" (5 6 x 8 9) is twice harder to complete than other straights (x 5 6 7 8 x) even though it feels just as likely, so it's reckless to try to get one
  • chance of failure is never 0%
  • it's not about winning all the time, it's about managing your wins in a sea of losses, and using your losses to your advantage
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
@mackuba
mackuba / gist:1031086
Created June 17, 2011 08:48
Kanbanery column width bookmarklet
javascript:(function(){var w=prompt("Enter column width in pixels (press enter for default):"); w = w && parseInt(w, 10) || 300; $('.column-view-body').css('width', w + 'px'); $('.column-view').css('max-width', w + 'px'); $('.ul-columns-section-body').css('width', ($('.column-view-body').length * (w + 15)) + 'px');})()
@mackuba
mackuba / kanbanery_multi_filter.js
Created October 24, 2011 13:04
Kanbanery multi-task-type filter
javascript:(function() { var list = prompt("Enter list of task types to show, separated by commas (leave empty to show all):"); var wait = $("<p>Please wait…</p>").css({ 'font-size': '20px', 'color': 'white', position: 'absolute', top: '10px', left: '500px', width: '150px' }).appendTo($('body')); setTimeout(function() { if (!list) { $('.task-view').each(function(i, t) { $(t).show() }); } else { $('li.placeholder').each(function(i, pl) { $(pl).view().showRealView() }); var types = _.map(list.split(','), function(el) { return $.trim(el.toLowerCase()) }); $('.task-view').each(function(i, t) { var label = $('.disp-task-type-name', t); var type = $.trim($(label).text().toLowerCase()); if (_.indexOf(types, type) == -1) { $(t).hide(); } else { $(t).show(); } }); } wait.remove(); }, 10);})();
@mackuba
mackuba / kill_utm.js
Created October 27, 2011 12:41
Bookmarklet which deletes that utm_* crap from the URL
javascript:(function() { var s = ""; var args = location.search.substring(1).split('&'); for (var a = 0; a < args.length; a++) { var key = args[a].split('=')[0]; if (!key.match(/^utm_/)) { s += '&' + args[a]; }} if (s) { s = '?' + s.substring(1); } location.href = location.origin + location.pathname + s; })()
@mackuba
mackuba / gist:1346371
Last active September 27, 2015 23:08
Benchmark - running an empty spec file on Ruby 1.9.2 vs 1.9.3
### without spork
$ rvm 1.9.2
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]
$ time bundle exec rspec spec/controllers/notifications_controller_spec.rb
No DRb server is running. Running in local process instead ...
No examples found.
Finished in 0.10633 seconds
@mackuba
mackuba / symbolicate.rb
Created July 13, 2012 14:09
A script to symbolicate iOS crash logs
#!/usr/bin/env ruby
app = ARGV[0]
executable = app + "/" + app[/[\w\-]+\.app/].split('.').first
lines = STDIN.read
lines.each do |l|
if l =~ /PCRM/
address = l[/0x\w\w+/]
decoded = `atos -arch armv7 -o #{executable} #{address}`.strip
print l.gsub(/\+ .*$/, decoded)
@mackuba
mackuba / lambda_lounge_notatki.md
Last active December 15, 2015 19:49
Notes from Kraków Lambda Lounge meetup [PL]

Notatki z Lambda Lounge meetup

Ogólnie:

  • immutability
  • higher-order functions
  • first-class functions
  • stan przekazywany explicit w argumentach, a nie przechowywany gdzieś tam i zmieniany w miejscu przez nie wiadomo kogo
  • referential transparency - funkcja dostając dane argumenty zawsze zwróci tą samą wartość
  • nie ma rozróżnienia na == vs. equals
@mackuba
mackuba / configure_project.sh
Last active December 16, 2015 02:59
Creates copies of all example config files in the project and shows them to you in the editor for tweaking/confirmation.
#!/bin/bash
for FILE in $(find config -name '*.sample' -or -name '*.example'); do
COPY=$(echo "$FILE" | sed -E -e 's/\.[^.]+$//')
if [ ! -e "$COPY" ]; then
cp "$FILE" "$COPY"
echo "Created $COPY"
if [ "$EDITOR" ]; then
$EDITOR "$COPY"