SegueManager has been moved to a CocoaPod, see the repository.
It is still possible to use it by just copying a single file into your project:
- SegueManager.swift for iOS
- SegueManager.swift for OSX
// Current (C# 5) syntax | |
var request = new CreateIndexRequest("new-index-name") | |
{ | |
IndexSettings = new IndexSettings | |
{ | |
Settings = new Dictionary<string, object> | |
{ | |
{"index.settings", "value"} | |
}, | |
Mappings = new List<RootObjectMapping> |
SegueManager has been moved to a CocoaPod, see the repository.
It is still possible to use it by just copying a single file into your project:
function fixMapScrollwheel(map) { | |
map.setOptions({ scrollwheel: false }); | |
google.maps.event.addListener(map, 'click', function() { | |
map.setOptions({ scrollwheel: true }); | |
}); | |
google.maps.event.addListener(map, 'mouseout', function() { | |
map.setOptions({ scrollwheel: false }); | |
}); |
// This is now available as a full library instead of a gist: https://github.com/Q42/RxPromise |
import Foundation | |
let obj = NSNumber(int: 2) | |
func correct<T>() -> T? { | |
if let val = obj as? T { | |
println("matching types") | |
return val | |
} |
/* Domain model */ | |
// A Profile consists of a person name and an optional avatar | |
struct Profile { | |
let personName: PersonName | |
let avatarURL: NSURL? | |
} | |
// These are the UX rules for showing a greeting: |
// We can use Phantom Types to provide strongly typed acces to NSUserDefaults | |
// Similar to: http://www.objc.io/blog/2014/12/29/functional-snippet-13-phantom-types/ | |
// A key to UserDefaults has a name and phantom type | |
struct Key<T> { | |
let name: String | |
} | |
// Functor type class ported to C# | |
// Only tested with: Mono C# compiler version 2.4.2.3 | |
// | |
// Because .NET doesn't support higher kinded generics, we can't exactly port | |
// the Functor type class. | |
// However, if we're willing to give up a bit of type safety, we can get the | |
// IFuctor interface to work. | |
// | |
// We only have to add a single type cast, directly after using fmap. E.g: | |
// var xs = new List<int>(); |
// Read type class ported to C# | |
// Only tested with: Mono C# compiler version 2.4.2.3 | |
// | |
// Because there are no static interface members, new instances of the | |
// Dictionary classes have to be created (although they contain no state). | |
// | |
// The functions using the read method (like mulStrings) explicitly mention | |
// `int` in IReadDictionary<int>, but that's just like `x = read "4" :: Int` in | |
// Haskell. | |
// |
{-# LANGUAGE DoRec #-} | |
module ExprLang where | |
import Control.Monad.Error | |
import Data.List | |
import Data.Maybe | |
-- Language |