This file contains hidden or 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
Software | |
======== | |
- Deckset Version 2.0 - https://www.deckset.com/ | |
- Dash App Version 4.0 - https://kapeli.com/dash | |
- GitTower - https://www.git-tower.com/mac | |
- 1Password - https://1password.com |
This file contains hidden or 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
//: stolen from https://www.objc.io/blog/2014/11/17/functional-snippet-7-applicative-functors/ | |
func login(email: String, pw: String, success: Bool -> ()) { | |
if email == "email" && pw == "pw" { | |
success(true) | |
} else { | |
success(false) | |
} | |
} |
This file contains hidden or 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
//example from https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language/TypeCasting.html | |
//data | |
var things = [Any]() | |
things.append(0) | |
things.append(0.0) | |
things.append(42) | |
things.append(3.14159) | |
things.append("hello") | |
things.append((3.0, 5.0)) |
This file contains hidden or 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
/* | |
based on https://twitter.com/chriseidhof/status/695150433967456256 | |
*/ | |
var funs : [() -> Int] = [] | |
for(var i = 0; i < 10; i++) { | |
funs.append({[i] () -> Int in //capture list -> capture by copy | |
return i | |
}) | |
funs.append({() -> Int in // capture by reference |
This file contains hidden or 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/UIKit.h> | |
#import <MapKit/MapKit.h> | |
#import <SDWebImage/UIImageView+WebCache.h> | |
#import <Foundation/Foundation.h> | |
#import <AudioToolbox/AudioServices.h> | |
#import <CoreMotion/CoreMotion.h> | |
#import <CoreLocation/CoreLocation.h> | |
#import <CoreBluetooth/CoreBluetooth.h> | |
#import <Parse/Parse.h> | |
#import <AFNetworking.h> |
This file contains hidden or 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
def unless(condition:Boolean, value:Int, then: => Unit ) = { | |
if(!condition) { | |
then | |
} | |
} | |
unless(1+2==3, 42, throw new RuntimeException) //no runtime exception | |
def unless(condition:Boolean, value:Int, then:Int => Unit ) = { | |
if(!condition) { | |
then(value) |
This file contains hidden or 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
class Animal() { | |
def msg()=println("Animal") | |
} | |
trait Furry extends Animal { | |
override def msg()={ | |
super.msg() | |
println("Furry") | |
} | |
} | |
trait HasLegs extends Animal { |
This file contains hidden or 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
//pattern matching with types | |
abstract class Point { | |
def x : Int | |
def y : Int | |
} | |
case class Point3D(x:Int, y:Int, z:Int) extends Point | |
val p : Point = Point3D(1,2,3) | |
def matchAPoint(p : Point) = { |
This file contains hidden or 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
--guess my hometown | |
gisdb> select name from gemeinden where st_touches(geom, (select geom from gemeinden where gid=221)); | |
/* | |
+----------------+ | |
| name | | |
|----------------| | |
| St. Gallen | | |
| Hundwil | | |
| Teufen (AR) | | |
| Herisau | |
This file contains hidden or 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
namespace LinqTests | |
{ | |
class Student { | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public int Age { get; set; } | |
} | |
class Course { |
NewerOlder