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 / MKAnnotationView-v1.swift
Last active August 17, 2016 12:55
Swift MKAnnotationView WTF
/*
MKAnnotationView has one init listed in its documentation, initWithAnnotation:reuseIdentifier:, so let's override that.
But this causes a runtime exception:
fatal error: use of unimplemented initializer 'init(frame:)' for class 'PulsatingDotMarker'
*/
class PulsatingDotMarker: MKAnnotationView {
let innerCircle: UIView
@mackuba
mackuba / swift_programming_language_b3.md
Last active June 11, 2016 17:11
I made a diff of the versions of Swift ebooks between the early June and early July versions. I'm not sure if I can post it publicly, but here's a summary of what's updated:
  • across all sections:

    • changed all occurrences of the a..b operator to a..<b
    • changed all occurrences of a Something[] array type to [Something]
    • changed some occurrences of an Array(values) array initialization to [Something](values)
    • changed some occurrences of a Dictionary<Key, Value> dictionary type to [Key: Value]
  • Swift Tour:

    • added a line:
@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
@mackuba
mackuba / decapsify.rb
Last active January 3, 2016 14:08
Clean up stupid docs that CAPITALIZE words like MUST or SHOULD and make it very HARD to READ such TEXT.
#!/usr/bin/env ruby
STDIN.each_line do |line|
print line.gsub(/\b[A-Z]{2,}\b/) { |word| word.downcase }
end
@mackuba
mackuba / coworking.md
Last active March 21, 2023 08:21
Lista coworkingów w Krakowie

Coworking w Krakowie

Update 28.04.2018

Otworzyło się ostatnio tyle nowych coworków, że nie nadążam tego odwiedzać :) Będę się starał stopniowo aktualizować listę, w międzyczasie polecam przeglądnąć komentarze pod postem. (Nie chcę szczerze mówiąc przenosić tego do jakiegoś bardziej zorganizowanego repozytorium, bo chcę, żeby to pozostało takim moim osobistym nieobiektywnym review tych coworków - ciężko byłoby uzgadniać, czy w danym miejscu jest głośno, albo czy jest fajna atmosfera... W razie wątpliwości, post jest dostępny na licencji WTFPL :)

Przydatne linki:

@mackuba
mackuba / skype_history_export.sh
Created October 22, 2013 15:35
Exports the history of conversations with a specific person from Skype (OSX) to an HTML file
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <your_username> <contact_username>"
exit 1
fi
echo "<!DOCTYPE html><html><head>"
echo "<style>"
echo "table { border-collapse: collapse; width: 800px; }"
@mackuba
mackuba / hive_joel.md
Last active December 17, 2015 23:38
Notes from the Hive53 meetup with Joel Spolsky (14.05.2013)

(This is mostly based on this post from 2000.)

There are two types of startups you can create. You have to know from the start which one it’s going to be. If you can't decide, or start using the rules from the wrong kind of startup, you’ll probably lose.

Type 1: Get Big Fast startup

  • Stack Overflow, Facebook, Yelp, Amazon, Trello
  • has to grow quickly
  • concentrates on getting as many users as possible in order to earn money in the future in some way
  • relies on VC money
@mackuba
mackuba / rupy_2012_notes.md
Last active December 17, 2015 22:09
Notes from RuPy 2012 (http://12.rupy.eu)

Javascript as language for native apps (Stepan Bechynsky)

  • Windows RT - new system library for Windows apps, unified for Intel and ARM computers and tablets
    • can be used from C++, C# (with XAML) or HTML/Javascript apps
    • HTML/Javascript apps can access the whole RT API and standard browser API
    • WinJS - Javascript bindings for WinRT and application framework
  • Visual Studio 2012 is needed to build the app, but most of the work can be done on any OS, as it’s mostly just JS
  • controls: <div data-win-control="WinJS.UI.ToggleSwitch" data-win-options="{title: '...'}">
  • access from JS to any system APIs, like camera capture, updating live tiles
  • package.appmanifest - application config, e.g. permissions that the app requests from the user
@mackuba
mackuba / oauth_generator.rb
Last active December 17, 2015 02:38
Generates OAuth access key & secret for Twitter apps
#!/usr/bin/env ruby
consumer_key = ENV['KEY']
consumer_secret = ENV['SECRET']
unless consumer_key && consumer_secret
puts "Please set consumer key and secret from your Twitter app's settings: KEY=... SECRET=... ruby oauth_generator.rb"
exit 1
end
@mackuba
mackuba / ip-monitor.sh
Created April 22, 2013 21:40
Monitors external IP address using curlmyip.com and sends an email when it changes (should be run from cron)
#!/bin/bash
FILE="$HOME/ip-monitor.txt"
OLD_IP=`cat $FILE`
CURRENT_IP=`curl -s http://curlmyip.com`
EMAILS="my.address@gmail.com"
SUBJECT="IP address changed"
FROM="IP Address Bot <root@localhost>"
if [ "$CURRENT_IP" ]; then