(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.
| Enabling communication with API if server has Self-Signed Certificate |
| package com.netflix.experiments.rx; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import rx.Observable; | |
| import rx.Observable.OnSubscribe; |
| func encode<T>(var value: T) -> NSData { | |
| return withUnsafePointer(&value) { p in | |
| NSData(bytes: p, length: sizeofValue(value)) | |
| } | |
| } | |
| func decode<T>(data: NSData) -> T { | |
| let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type)) | |
| data.getBytes(pointer) | |
(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.
| /* | |
| * Flyspeck is Dependency Injection Container. | |
| * | |
| * Copyright (c) 2014 Anton Medvedev | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is furnished |
| -- Working through the Yorgey lectures on Applicatives for Haskell and trying to work out the homework... | |
| -- A parser for a value of type a is a function which takes a String | |
| -- represnting the input to be parsed, and succeeds or fails; if it | |
| -- succeeds, it returns the parsed value along with the remainder of | |
| -- the input. | |
| newtype Parser a = Parser { runParser :: String -> Maybe (a, String) } | |
| -- For example, 'satisfy' takes a predicate on Char, and constructs a | |
| -- parser which succeeds only if it sees a Char that satisfies the |
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: mpd-autoplay | |
| # Required-Start: mpd | |
| # Required-Stop: | |
| # Should-Start: | |
| # Should-Stop: | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 |
| public class MyApp extends Application { | |
| @Override | |
| public void onCreate() { | |
| TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf | |
| } | |
| } |
| Parse.initialize("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); | |
| var file; | |
| function fileSelected() { | |
| var file = document.getElementById('fileToUpload').files[0]; | |
| if (file) { | |
| var fileSize = 0; | |
| if (file.size > 1024 * 1024) |