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
//Swift 2.0 | |
import Foundation | |
protocol vcProtocol { | |
func hidePuzzleMessage() | |
func showPuzzleMessage() | |
func prepareBoard() | |
} | |
class ViewController: vcProtocol { |
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
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' | |
green='\033[0;32m' |
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 | |
import XCPlayground | |
import Framework2 | |
enum PlayerPerspective { | |
case Black, White | |
} | |
class SampleChessBoardView : UIView { | |
var margin: CGFloat = 15 |
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 XCPlayground | |
import UIKit | |
import Framework3 | |
XCPSetExecutionShouldContinueIndefinitely() | |
var r = request(.GET, "http://en.lichess.org/api/user/peropaal") | |
.response { (request, response, data, error) in | |
println(request) | |
println() |
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 Cocoa | |
struct Constraint { | |
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat) | |
let data: T | |
func create() -> CAConstraint { | |
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset) | |
return newConstraint as CAConstraint | |
} |
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 Cocoa | |
struct Constraint { | |
typealias T = (attribute: CAConstraintAttribute, relativeTo:String, relatedAttribute: CAConstraintAttribute, offset: CGFloat) | |
let data: T | |
func create() -> CAConstraint { | |
let newConstraint: AnyObject! = CAConstraint.constraintWithAttribute(data.attribute, relativeTo: data.relativeTo, attribute: data.relatedAttribute, offset: data.offset) | |
return newConstraint as CAConstraint | |
} |
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
/// | |
- (ConfigureCellBlock)dimmedCell { | |
return [[^(UITableViewCell *cell) { | |
cell.backgroundColor = [self colorFor:@"sub.cell.background"]; | |
cell.selectionStyle = UITableViewCellSelectionStyleNone; | |
} copy] autorelease]; | |
} | |
/// | |
- (ConfigureBadgeBlock)standardBadge { |
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
// log every category | |
[[L4Logger rootLogger] setLevel:[L4Level all]]; | |
// send log messages to console | |
L4ConsoleAppender *consoleAppender=[[[L4ConsoleAppender alloc] initTarget:YES withLayout: [L4Layout simpleLayout]] autorelease]; | |
[[L4Logger rootLogger] addAppender: consoleAppender]; | |
L4Logger *theLogger = [L4Logger loggerForClass:[L4FunctionLogger class]]; | |
[theLogger setLevel:[L4Level debug]]; | |
// | |
log4Info(@"The logging system has been initialized."); |
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 'java.awt.Color) | |
(def *default-color-fraction* 0.2) | |
(def *default-blend-fraction* 0.5) | |
(defn- format-hex [c] | |
(str "#" (format "%02x%02x%02x" | |
(.getRed c) | |
(.getGreen c) |
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
(defn inside-byte [v] | |
(cond | |
(< v 0) 0 | |
(> v 255) 255 | |
:else v)) | |
(defn darker- [color fraction] | |
(let [fr (- 1.0 fraction) | |
red (inside-byte (-> (.getRed color) (* fr) Math/round)) | |
green (inside-byte (-> (.getGreen color) (* fr) Math/round)) |