using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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
// create an IAM Lambda role with access to dynamodb | |
// Launch Lambda in the same region as your dynamodb region | |
// (here: us-east-1) | |
// dynamodb table with hash key = user and range key = datetime | |
console.log('Loading event'); | |
var AWS = require('aws-sdk'); | |
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'}); | |
exports.handler = function(event, context) { |
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
// Mark: -Facebook | |
func loginWithFaceBookInBackground(sender:UIButton) { | |
let permissions = ["public_profile", "email"] | |
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions) { (_user:PFUser?, _error:NSError?) in | |
if _error == nil { | |
if let possibleUser = _user{ | |
print("\(possibleUser.sessionToken) , \(possibleUser)") | |
if possibleUser.isNew { | |
self.accessingFacebookCredentialsToSaveToParse() |
using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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 PlaygroundSupport | |
import Foundation | |
import UIKit | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
//data model | |
struct User { | |
let name:String | |
} | |
enum Result<T> { |
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
osascript -e 'tell application "iOS Simulator" to quit' | |
osascript -e 'tell application "Simulator" to quit' | |
xcrun simctl erase all |
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
/* | |
An Object is considered to be a **functor** when it implements fmap (fmap referring to functor map not flatmap) | |
-[Rules] This fmap should | |
* preserve Identity (x to y) and (y to x ) should be the same value every time | |
* and be composable | |
map isn't fmap but fmap can do what map does | |
map only operates on pure function, where fmap is lifted that pure function to operate on functor type | |
*/ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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 Foundation | |
import RxSwift | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
class TryOut { | |
private var timer: Timer! | |
private let data = Array<Int>(1...5) // data to broadcast asynchronously |
OlderNewer