This file contains hidden or 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
fun onClickLogin(@suppress("UNUSED_PARAMETER") v: View) { | |
Log.i(TAG, "onClickLogin "+email+" "+password+" "+Token.type+" "+Token.token); | |
Server.login(email, password, Token.type, Token.token) | |
.successUi { json -> | |
Log.i(TAG, "login successful, json: "+json.toString()) | |
val user = json.getJSONObject("user") | |
AppState.auth.setUser(user.getInt("userid"), | |
user.getString("email"), | |
user.getString("name")) | |
Toast.makeText(this.getContext(), |
This file contains hidden or 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
fun post(url :String, json :JSONObject) : Promise<JSONObject> { | |
return Promise.async(Callable<JSONObject> { | |
val response: Response = this.postJson(url, json) | |
if (!response.isSuccessful()) | |
throw IOException(response.toString()) | |
val str = response.body().string() | |
return JSONObject(str) | |
}) | |
} |
This file contains hidden or 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
Observable<Integer> oi = Observable.create(new OnSubscribe<Integer>() { | |
@Override | |
public void call(Subscriber<? super Integer> subscriber) { | |
// we now receive a Subscriber instead of Observer | |
for (int i = 1; i < 1000000; i++) { | |
// the OnSubscribe can now check for isUnsubscribed | |
if (subscriber.isUnsubscribed()) { | |
return; | |
} | |
subscriber.onNext(i); |
This file contains hidden or 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
sourceSets { | |
main.java.srcDirs += 'src/main/kotlin' | |
//main.kotlin.srcDirs += 'src/main/kotlin' | |
} |
This file contains hidden or 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 React from 'react'; | |
import Router, { DefaultRoute, Link, Route, RouteHandler } from 'react-router'; | |
import App from './components/App.jsx'; | |
import Home from './components/Home.jsx'; | |
import Login from './components/Login.jsx'; | |
import Register from './components/Register.jsx'; | |
export default ( | |
<Route name="app" path="/" handler={App}> |
This file contains hidden or 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
let React = require('react/addons'); | |
let Router = require('react-router'); | |
let {Link, RouteHandler} = Router; | |
let Morearty = require('morearty'); | |
let mui = require('material-ui'); | |
let {RaisedButton, TextField} = mui; | |
let l = require('../utils/lang'); |
This file contains hidden or 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
arr = [false, false, false, true, false, false, true, false, true, false] | |
Rx.Observable.from(arr) | |
.pairwise().filter((val) -> val[0]) | |
.map((val) -> Rx.Observable.from val) | |
.concatAll() | |
.subscribe( | |
(val) -> console.log "val", val | |
) |
This file contains hidden or 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
arr = [false, false, false, true, false, false, true, false, true, false] | |
Rx.Observable.from(arr) | |
.pairwise().filter((val) -> val[0]) | |
.subscribe( | |
(val) -> console.log "val", val | |
) | |
# Outputs: | |
# val [ true, false ] |
This file contains hidden or 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
# watchify -v -t coffeeify -o www/bundle.js -e client/client.coffee | |
# browserify -t coffeeify -o www/bundle.js -e client/client.coffee | |
C = require 'cyclejs' | |
Rx = C.Rx | |
h = C.h | |
root = window ? exports | |
Page1Model = C.createModel (intent) -> | |
route$: intent.get('changeRoute$').startWith('/page1') |
This file contains hidden or 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
From: https://github.com/krisajenkins/wispjs-mode/blob/master/wispjs-mode.el | |
(dolist '(lambda (char) | |
(modify-syntax-entry char "w" wispjs-mode-syntax-table)) | |
'(?_ ?~ ?. ?- ?> ?< ?! ??)) | |
bugs out with: | |
File mode specification error: (wrong-type-argument listp #[(char) "\302\303 #\207" [char wispjs-mode-syntax-table modify-syntax-entry "w"] 4]) |