I hereby claim:
- I am hsavit1 on github.
- I am henry_s (https://keybase.io/henry_s) on keybase.
- I have a public key ASBehtOERO0XSzcL87y6jBqgpvrxRE2XOHqBxl2LZc4Z5Qo
To claim this, I am signing this object:
/* Creates a server that is bound to a socket to listen for incoming | |
connections. Also creates a client which sends a "Hello world" | |
message to server. Shows how servers can be made in Swift. | |
*/ | |
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) | |
import Darwin | |
#else | |
import Glibc | |
#endif |
import Foundation | |
// A bunch of convenience things | |
func const <A, B> (b: B) -> A -> B { | |
return { _ in b } | |
} | |
func repeat <A> (n: Int) -> A -> [A] { | |
return { a in | |
return map(Array(1...n), const(a)) | |
} |
import { buildSchema, graphql } from "graphql"; | |
// Construct a schema, using GraphQL schema language | |
let graphqlSchema = buildSchema(` | |
type Query { | |
recipes: [Recipe] | |
recipes_by_pk(id: Int!): Recipe | |
} | |
type Recipe { | |
id: ID! |
defmodule SqlParser do | |
def run() do | |
input = "select col1 from ( | |
select col2, col3 from ( | |
select col4, col5, col6 from some_table | |
) | |
) | |
" | |
IO.puts("input: #{inspect(input)}\n") | |
IO.inspect(parse(input)) |
I hereby claim:
To claim this, I am signing this object:
@interface RACGestureViewController () | |
@property(weak, nonatomic) IBOutlet UILabel *translationLabel; | |
@property(weak, nonatomic) IBOutlet UILabel *stateLabel; | |
@property(strong, nonatomic) RACSubject *animationDelegate; | |
@property(weak, nonatomic) IBOutlet UILabel *pinchLabel; | |
@end | |
@implementation RACGestureViewController |
// | |
// main.m | |
// 101RACSamples | |
// | |
// Created by Matthew Doig on 1/26/14. | |
// Copyright (c) 2014 DWI. All rights reserved. | |
// | |
#pragma mark Asynchronous operators |
protocol AsyncGeneratorType { | |
typealias Element | |
typealias Fetch | |
mutating func next(fetchNextBatch: Fetch, onFinish: ((Element) -> Void)?) | |
} | |
/// Generator is the class because struct is captured in asynchronous operations so offset won't update. | |
class PagingGenerator<T>: AsyncGeneratorType { | |
typealias Element = Array<T> | |
typealias Fetch = (offset: Int, limit: Int, completion: (result: Element) -> Void) -> Void |
#import "UITextViewHideKeyboardOnEnterBehaviour.h" | |
#import "UITextView+Multicast.h" | |
@implementation UITextViewHideKeyboardOnEnterBehaviour | |
- (id)initWithTextView:(UITextView *)textView | |
{ | |
if (self=[super init]) | |
{ | |
[textView.multicastDelegate addDelegate:self]; |
class TailPromise(object): | |
__metaclass__ = PromiseMetaClass | |
def __init__(self,func,args,kw): | |
self.__func = func | |
self.__args = args | |
self.__kw = kw | |
def __arginfo__(self): | |
return self.__args, self.__kw |