Skip to content

Instantly share code, notes, and snippets.

// Import sensate
import Sensate, { Event, Message } from 'sensate'
// Import wanted gateways
import SlackGateway from 'sensate-gateway-slack'
// Logging
const log = () => console.log.apply(console, arguments)
// Create a new sensate instance that connects to slack
let (background, primary, secondary) = image.analyzeColors()
switch background {
case primaryText.isContrasting(background):
self.titleLabel.textColor = primaryText
case secondaryText.isContrasting(background):
self.titleLabel.textColor = secondaryText
///
/// All targets have the same base URL
///
let BaseURL = NSURL(string: "http://example.com/v1")!
///
/// First target handles user-related api endpoints
///
/// .Authentication needs to:
/// 1. Make the request to the path with the given credentials
// Brawl Tests
import * as Brawl from "./brawl"
// Create a new match
let match = new Brawl.Match();
// Enter some players
let friendly = new Brawl.Player("Friendly", match);
let opposing = new Brawl.Player("Opposing", match);
// Grab API instance
let API = APIClient.instance
// Attempt to authenticate with username and password
let Authentication = API.authenticate(username, password: password)
Authentication.onSuccess { user in
println("Logged in as \(user.userName!)!")
// Load user images after a successful sign-in
let UserImages = API.imagesForUserId(user.id!, nextToken: nil)
reduce(
emailAddressField.textDynamic(),
passwordField.textDynamic(),
confirmPasswordField.textDynamic(),
false) { email, password, confirm in
return email != "" && password != "" && confirm != "" && password == confirm
} ->> signupButton
#import <Foundation/Foundation.h>
@interface IOSTools : NSObject
- (NSString *)getCountry;
@end
// Splitter view recognizer should only begin if we're truly touching something inside the splitter view
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer == _splitterPanRecognizer) {
CGPoint location = [gestureRecognizer locationInView:self.view];
BOOL didHitView = NO;
NSArray *hitTestViews = @[_splitterView];
hitTestViews = [hitTestViews arrayByAddingObjectsFromArray:_splitterView.subviews];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *contents = [fileManager contentsOfDirectoryAtPath:directoryPath error:NULL];
NSEnumerator *e = [contents objectEnumerator];
NSString *filename;
while ((filename = [e nextObject])) {
NSString *filePath = [directoryPath stringByAppendingPathComponent:filename];
if ([[filePath pathExtension] isEqualToString:@"jpg"]) {
// jpegitz
//
// AccountsViewController.h
//
// Created by Nico Hämäläinen on 28/03/14.
//
#import <UIKit/UIKit.h>
@interface AccountsViewController : UIViewController