Basic unit type:
λ> replTy "()"
() :: ()Basic functions:
| const serviceValues = [ 2, 3, 4 ]; | |
| // convert values array into a stream of individual values: Obs[...num] | |
| return Observable.of(serviceValues) | |
| // call service on each value and get Observable in return: Obs[Obs[newValFromService]] | |
| .map(val => serviceApi(val)) | |
| // convert stream of observables into a stream of a single array of observables Obs[ [Obs[newVal]] ] | |
| .toArray() | |
| // trigger all the service calls with maximum concurrenct | |
| .switchMap((serviceCalls) => Observable.combineLatest(serviceCalls)) | |
| .subscribe(newVals => console.log('new values from server: ', newVals)) // [...{id: 2, ...data}, {id: 3, ...dat}] |
| var Bot = require('node-telegram-bot-api') | |
| var watson = require('watson-developer-cloud'); | |
| var request = require('request'); | |
| var config = require('./config'); | |
| var speech_to_text = watson.speech_to_text({ | |
| username: config.watson.username, | |
| password: config.watson.password, | |
| version: 'v1', | |
| url: 'https://stream.watsonplatform.net/speech-to-text/api' |
| #import <Foundation/Foundation.h> | |
| #import <XCTest/XCTest.h> | |
| NS_ASSUME_NONNULL_BEGIN | |
| @interface ExpectationDelegateProxy : NSProxy | |
| @property (nonatomic) SEL selector; | |
| @property (nonatomic) Protocol *protocol; | |
| @property (nonatomic) XCTestExpectation *expectation; |
| import numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import os | |
| def computeCost(X, y, theta): | |
| inner = np.power(((X * theta.T) - y), 2) | |
| return np.sum(inner) / (2 * len(X)) | |
| def gradientDescent(X, y, theta, alpha, iters): |
| import java.io.FileDescriptor; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.OutputStream; | |
| import java.io.PrintStream; | |
| public class HelloWorld{ | |
| private static HelloWorld instance; | |
| public static void main(String[] args){ | |
| instantiateHelloWorldMainClassAndRun(); |
| @Override | |
| public boolean onTouchEvent(MotionEvent event) { | |
| if (mTopCard == null) { | |
| return false; | |
| } | |
| if (mGestureDetector.onTouchEvent(event)) { | |
| return true; | |
| } | |
| Log.d("Touch Event", MotionEvent.actionToString(event.getActionMasked()) + " "); | |
| final int pointerIndex; |
| <?php | |
| /** | |
| * DQuid Library | |
| * | |
| * Retrieves values from a Bay Tek Game machine given the serial number. | |
| * / | |
| class Dquid | |
| { | |
| var $serial_number; |
| // another kind of flattening; see: http://blog.vullum.io/javascript-flow-callback-hell-vs-async-vs-highland/ | |
| var express = require('express') | |
| var fs = require('fs') | |
| var app = express() | |
| app.post('/process-file', onProcessFile) | |
| function onProcessFile(req, res) { | |
| var inputFile = 'input.txt' |
| // Node.js CheatSheet. | |
| // Download the Node.js source code or a pre-built installer for your platform, and start developing today. | |
| // Download: http://nodejs.org/download/ | |
| // More: http://nodejs.org/api/all.html | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html |
Basic unit type:
λ> replTy "()"
() :: ()Basic functions: