This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dein fehler: '[AnyObject]?' is not a subtype of 'Void' | |
// dismissViewControllerAnimated will eine Closure mit der Typ-Signatur () -> Void. | |
// Wenn die Closure nur aus einer Expression besteht, wie hier der Aufruf von popToViewController | |
// dann wird der Return Value dieser Expression automagisch als Return der Closure angenommen. | |
// popToViewController gibt [AnyObject]? zurück. Das ist nicht Void. | |
// Wie fixen? So sollte es gehen. | |
dismissViewControllerAnimated(true, completion: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension String { | |
func NSRangeOfString(string: String) -> NSRange? { | |
if let range = self.rangeOfString(string) { | |
let loc = distance(self.startIndex, range.startIndex) | |
let length = distance(range.startIndex, range.endIndex) | |
return NSMakeRange(loc, length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildTemplate (spec, template) { | |
return function (context) { | |
var allParamsExist = spec.every(function (key) { | |
return context.hasOwnProperty(key) && (context[key] !== undefined) | |
}) | |
if (!allParamsExist) { | |
throw "Context object misses needed parameters" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
p { margin-top: 5em; } | |
input[type=submit] { | |
/* Ich hab das Gefühl, das hier ist mehr Vodoo: | |
-webkit-appearance: none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rövarspråket | |
*/ | |
html { | |
background: linear-gradient(0deg, khaki, green); | |
min-height: 100%; | |
} | |
table { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyArray () { console.log("bla"); } | |
MyArray.prototype = Object.create(Array.prototype) | |
var x = new MyArray() | |
x.push("lala") | |
x.push("lolo") | |
x.indexOf("lolo") // -> 1 | |
x instanceof Array // -> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define [ | |
"helper/HostApp" | |
"controller/Timeline" | |
], | |
(HostApp, Timeline) -> | |
class Mentions extends Timeline | |
constructor: -> | |
@initialized = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.prototype.create = function (konstruktor /*, args */) { | |
// Objekt mit dem NC erstellen | |
var instanz = Object.create(konstruktor.prototype, { | |
notificationCenter : { | |
value : this.notificationCenter; | |
} | |
}); | |
// Das Objekt noch mal initalisieren |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.and = function () { | |
var predicates = Array.prototype.slice.call(arguments); | |
predicates.unshift(this); | |
return (function (value) { | |
return predicates.every(function (predicate) { | |
return predicate(value); | |
}) | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A weird mixture between functional and imperative. | |
// I like putting some lambdas into their own functions, for some | |
// degree of self-documenting and readability later on. | |
// ... | |
var nodes, fontnames, firstpick, | |
result = false; | |
function isEditableTextnode(node) { |