Skip to content

Instantly share code, notes, and snippets.

orkoden / demotask.swift
Last active Apr 23, 2019
swift solution to codility demo task
View demotask.swift
// MissingInteger
// Find the smallest positive integer that does not occur in a given sequence.
//This is a demo task.
//Write a function:
//public func solution(_ A : inout [Int]) -> Int
//that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A.
orkoden / fishytitles.m
Last active Apr 23, 2019
Swizzle all UIViewController titles to fish emoji 🐠
View fishytitles.m
IMP titleImp = imp_implementationWithBlock(^NSString *(__unsafe_unretained id foo){
return @"🐠";
SEL titleSelector = NSSelectorFromString(@"title");
Method existingTitle = class_getInstanceMethod([UIViewController class],
orkoden / karabiner.json.microsoftsculpt
Created Feb 9, 2017
Karabiner elements configuration file for using a Microsoft Sculpt Ergonomic Desktop keyboard with ISO-UK layout on macOS with US layout.
View karabiner.json.microsoftsculpt
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true
"profiles": [
"devices": [
"disable_built_in_keyboard_if_exists": false,
orkoden / karabiner.json.magicforce68
Created Feb 9, 2017
Karabiner elements configuration file for using a MagicForce68 keyboard on macOS
View karabiner.json.magicforce68
"profiles": [
"devices": [
"disable_built_in_keyboard_if_exists": false,
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 1957,
View StackView Tips
# StackView Tips
## Performance hack
### Old hack
Use a UITableViewCell's contentview. The layout will not bubble up from here. Keeps all layout restriced to that view.
Then set frame of cell.
orkoden / FizzBuzzWithoutIfAndModulo.m
Last active Aug 29, 2015
Fizzbuzz in Objective-C that works without if, modulo, lookup table
View FizzBuzzWithoutIfAndModulo.m
#import <Foundation/Foundation.h>
NSMutableArray* fizzbuzzreplace(NSMutableArray* numberArray, NSUInteger divider, NSString* replacementString)
for (NSUInteger i = divider; i < numberArray.count + 1; i = i + divider) {
[numberArray replaceObjectAtIndex:i - 1 withObject:replacementString];
return numberArray;
orkoden / hide or show desktop icons.applescript
Last active Sep 27, 2018
AppleScript to hide your messy desktop icons during presentations for Mac OS X.
View hide or show desktop icons.applescript
display dialog "Desktop icons visible or hidden?" buttons {"Visible", "Hidden"} with icon 2 with title "Switch to presentation mode" default button 1
set switch to button returned of result
if switch is "Hidden" then
do shell script "defaults write CreateDesktop -bool FALSE;killall Finder"
do shell script "defaults delete CreateDesktop;killall Finder"
end if
orkoden / lettermix.rb
Created Mar 3, 2015
Lettermix randomizes the letters in words, that are passed as arguments.
View lettermix.rb
#!/usr/bin/env ruby
ARGV.each do|a|
puts "#{a}".split("").shuffle.join
orkoden / FizzBuzz in Haskell.hs
Last active Aug 29, 2015
FizzBuzz in Haskell that I live coded as part of a demo for hackership
View FizzBuzz in Haskell.hs
data Fizzbuzz = FizzBuzz
| Fizz
| Buzz
deriving Show
fizzbuzz :: [Integer] -> String
fizzbuzz x = unlines (map fizzbuzzline x)
fizzbuzzline :: Integer -> String
fizzbuzzline x = fizzBuzzToString x (fizzBuzzFromNum x)
orkoden / HackerrankObjectiveCBoilerplate.m
Last active Dec 2, 2016 Boilerplate template for reading from STDIN and writing to STDOUT for Objective-C
View HackerrankObjectiveCBoilerplate.m
#import <Foundation/Foundation.h>
@interface HRSTDIOReadWriter : NSObject
@implementation HRSTDIOReadWriter
+(NSString*) readFromSTDIN
NSFileHandle *kbd = [NSFileHandle fileHandleWithStandardInput];
You can’t perform that action at this time.