Skip to content

Instantly share code, notes, and snippets.

View romyilano's full-sized avatar
😎
improving

Romy romyilano

😎
improving
View GitHub Profile
- (void)setupBackButtonWithSelector:(SEL)selector {
// create a custom button
LIButton *backButton = [LIButton buttonWithType:UIButtonTypeCustom];
backButton.positionInNavBar = LIButtonNavPositionLeft;
// more back button setup
// add back button to navigation bar
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = backItem;
}
//: Playground - noun: a place where people can play
import UIKit
protocol DataSource {
func fetchValue() -> String?
}
protocol DataSourceCacheStrategy {
func retrieve<T>(from: [DataSource], using: DataSource -> T?) -> T?
@romyilano
romyilano / fibonacci.js
Last active August 29, 2015 14:21 — forked from nathansmith/_fibonacci.md
they like to have people write the recursive version in coding interviews, but the the iterative version is more space efficient. it looks cool! most people blow the first 30 minutes just trying to define what a fibonacci number is so learn it well. it is found in nature and art.
function fib(num) {
'use strict';
var val;
if (num < 2) {
val = num;
}
else {
val = fib(num - 1) + fib(num - 2);
//
// BinaryDataScanner.m
//
// Copyright 2009 Dave Peck <davepeck [at] davepeck [dot] org>. All rights reserved.
// http://davepeck.org/
//
// This class makes it quite a bit easier to read sequential binary files in Objective-C.
//
// This code is released under the BSD license. If you use it in your product, please
// let me know and, if possible, please put me in your credits.
@romyilano
romyilano / readme.md
Last active August 29, 2015 14:21 — forked from max-mapper/readme.md
  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

struct PermutationSequenceGenerator<T> : GeneratorType {
var permutationSpaceGenerator: PermutationSpaceGenerator<Int>
let elements: [T]
init(elements: [T]) {
self.elements = elements
self.permutationSpaceGenerator = PermutationSpaceGenerator(objects: Array(indices(elements)))
}
@romyilano
romyilano / archivo.m
Last active August 29, 2015 14:23 — forked from sendoa/archivo.m
// http://objective-c.es/modern-objective-c-enum/
// http://nshipster.com/ns_enum-ns_options/
typedef NS_ENUM(NSUInteger, GBDaysOfWeek) {
GBSunday,
GBMonday,
GBTuesday,
GBWednesday,
GBThursday,
GBFriday,
Found this very interesting talk by Bryan Cantrill https://en.wikipedia.org/wiki/Bryan_Cantrill on Corporate Open Source Anti-Patterns: Doing It Wrong (youtube https://www.youtube.com/watch?v=NhgXQFk9noI & slides http://www.slideshare.net/bcantrill/corporate-open-source-antipatterns). His slides are verbose, a little rough, and hard to understand, so I took some notes and made a summary, trying to simplify:
Side-note - He pushes a few debatable viewpoints (common flamebait such as GPL vs other licenses), so take these phrasings with a grain of salt (wink)
Summary
Inverted Thinking:
Misconception that the benefits of open source are assumed to be primary ($). In actuality, benefits are typically secondary, tertiary, and one should consider the cost of sharing is pretty much $0.
Wishful Thinking: