- Create a project in XCode with the default settings
- iOS > Application > Single View Application
- Language: Swift
- Under project General settings, add ReactKit to Linked Framework and Libraries
- + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
- Now ReactKit would have been imported. Link it by choosing it from the list.
- + > lib.ReactKit.a
- Under project Build Settings,
{0: 'tench, Tinca tinca', | |
1: 'goldfish, Carassius auratus', | |
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
3: 'tiger shark, Galeocerdo cuvieri', | |
4: 'hammerhead, hammerhead shark', | |
5: 'electric ray, crampfish, numbfish, torpedo', | |
6: 'stingray', | |
7: 'cock', | |
8: 'hen', | |
9: 'ostrich, Struthio camelus', |
var log = console.log.bind(window.console); | |
function* powGenerator(){ | |
var result = Math.pow(yield "first arg",yield "sendond arg"); | |
return result; | |
} | |
var pow = powGenerator(); | |
log(pow.next().value); // "first arg" |
// modified from this: https://github.com/emiloberg/nativescript-emulator-reload | |
// all sources | |
var babelSrc = [ 'src/**/*.js', '!src/tns_modules', '!src/tns_modules/**', '!src/node_modules', '!src/node_modules/**' ]; | |
var jadeSrc = [ 'src/**/*.jade' ]; | |
var sassSrc = [ 'src/**/*.scss' ]; | |
var resources = [ 'src/{App_Resources,tns_modules,node_modules}/**', 'src/package.json']; | |
// Which emulator to run? |
// At first we should write three basic html tag | |
// include: | |
// 1) a video tag | |
// 2) a button | |
// 3) a canvas tag | |
// just like below: | |
// <video id="video" width=600 height=480 autoplay></video> | |
// <button id="snap">Snap</button> | |
// <canvas id="canvas" width=600 height=480></canvas> | |
// prepare work done! |
var gulp = require('gulp') | |
var sourcemaps = require('gulp-sourcemaps') | |
var babel = require('gulp-babel') | |
var concat = require('gulp-concat') | |
gulp.task('default',function(){ | |
gulp.src('src/**/*.js') | |
.pipe(sourcemaps.init()) | |
.pipe(concat('all.js')) | |
.pipe(babel()) |
<!doctype html> | |
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ --> | |
<html> | |
<head> | |
<title>iOS 8 web app</title> | |
<!-- CONFIGURATION --> |
(by @andrestaltz)
So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.
Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:
Rx.Observable.prototype.flatMapLatest(selector, [thisArg])
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
/** | |
* push callback function into arr array | |
* and observe the arr | |
* pretty cool! | |
**/ | |
var request = require('request'); | |
var options = { | |
url: "http://www.baidu.com" | |
}; | |
var t1 = new Date(); |
console.log('hello world') |