(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 is the stateful widget that the main application instantiates. | |
class MyStatefulWidget extends StatefulWidget { | |
const MyStatefulWidget({Key key}) : super(key: key); | |
@override | |
_MyStatefulWidgetState createState() => _MyStatefulWidgetState(); | |
} | |
/// This is the private State class that goes with MyStatefulWidget. |
httpCall(url: 'http://worldtimeapi.org/api/timezone/Europe/Rome') { (result) in | |
print(result) | |
} | |
func httpCall(url: String, completion: @escaping (_: [String: Any]) -> Void) { | |
let url = URL(string: url)! | |
let task = URLSession.shared.dataTask(with: url) {(data, response, error) in | |
guard let data = data else { return } |
(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.
WebGL experiment using ThreeJS. Move the fan and press to make wind, the lion will surely appreciate.
A Pen by Karim Maaloul on CodePen.
ListView lv = (ListView)findViewById(R.id.myListView); // your listview inside scrollview | |
lv.setOnTouchListener(new ListView.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
int action = event.getAction(); | |
switch (action) { | |
case MotionEvent.ACTION_DOWN: | |
// Disallow ScrollView to intercept touch events. | |
v.getParent().requestDisallowInterceptTouchEvent(true); | |
break; |
// file "NSDictionary+UrlEncoding.m" | |
#import "NSDictionary+UrlEncoding.h" | |
// helper function: get the string form of any object | |
static NSString *toString(id object) { | |
return [NSString stringWithFormat: @"%@", object]; | |
} | |
// helper function: get the url encoded string form of any object | |
static NSString *urlEncode(id object) { |
describe('/blog', function() { | |
it('returns blog posts as JSON', function(done) { | |
api.get('/blog') | |
.set('x-api-key', '123myapikey') | |
.auth('correct', 'credentials') | |
.expect(200) | |
.expect('Content-Type', /json/) | |
.end(function(err, res) { | |
if (err) return done(err); |
#!/bin/sh | |
rpm -Uih https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm | |
curl -L https://get.rvm.io | bash -s stable | |
rvm install 2.0.0 | |
rvm use 2.0.0@global --default | |
# for chinese user, if you have a wonderful speed ignore this part | |
# to have a faster download speed | |
# switch gem source to ruby.taobao.org |
{ | |
"country": { | |
"iso_code": "CO", | |
"names": { | |
"pt-BR": "Colômbia", | |
"es": "Colombia", | |
"ru": "Колумбия", | |
"en": "Colombia", | |
"zh-CN": "哥伦比亚", | |
"fr": "Colombie", |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
from twisted.application import service | |
from twisted.web import server, static | |
from twisted.web.resource import Resource | |
from twisted.web.wsgi import WSGIResource | |
from twisted.internet import reactor | |
from flask.views import MethodView |