next.js, nginx, reverse-proxy, ssl
$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt
func downloadFile(URL string) ([]byte, error) { | |
response, err := http.Get(URL) | |
if err != nil { | |
return nil, err | |
} | |
defer response.Body.Close() | |
if response.StatusCode != http.StatusOK { | |
return nil, errors.New(response.Status) | |
} | |
var data bytes.Buffer |
func downloadMultipleFiles(urls []string) ([][]byte, error) { | |
done := make(chan []byte, len(urls)) | |
errch := make(chan error, len(urls)) | |
for _, URL := range urls { | |
go func(URL string) { | |
b, err := downloadFile(URL) | |
if err != nil { | |
errch <- err | |
done <- nil | |
return |
[{"id":1,"msisdn":"083892652014","pkgid":"3212784","created_at":"2019-06-18 12:35:32","updated_at":"2019-06-18 12:35:32"},{"id":2,"msisdn":"083106406495","pkgid":"3212446","created_at":"2019-06-18 15:47:46","updated_at":"2019-06-18 15:47:46"},{"id":3,"msisdn":"083106406495","pkgid":"3212442","created_at":"2019-06-18 15:52:26","updated_at":"2019-06-18 15:52:26"},{"id":4,"msisdn":"083143561616","pkgid":"3212446","created_at":"2019-06-18 16:25:09","updated_at":"2019-06-18 16:25:09"},{"id":5,"msisdn":"083143561616","pkgid":"3212446","created_at":"2019-06-18 16:25:19","updated_at":"2019-06-18 16:25:19"},{"id":6,"msisdn":"083143561616","pkgid":"212442","created_at":"2019-06-18 16:26:20","updated_at":"2019-06-18 16:26:20"},{"id":7,"msisdn":"083143561616","pkgid":"3212784","created_at":"2019-06-18 16:28:15","updated_at":"2019-06-18 16:28:15"},{"id":8,"msisdn":"083143561616","pkgid":"3212784","created_at":"2019-06-18 16:28:33","updated_at":"2019-06-18 16:28:33"},{"id":9,"msisdn":"083812805815","pkgid":"3212446","creat |
const-string v8, "log-tag" | |
invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; | |
move-result-object v9 | |
invoke-static {v8, v9}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
<?php | |
// This can be found in the Symfony\Component\HttpFoundation\Response class | |
const HTTP_CONTINUE = 100; | |
const HTTP_SWITCHING_PROTOCOLS = 101; | |
const HTTP_PROCESSING = 102; // RFC2518 | |
const HTTP_OK = 200; | |
const HTTP_CREATED = 201; | |
const HTTP_ACCEPTED = 202; |
Publish some JSON data of your own by forking this gist. Delete my example data and add your own. It can be anything: a list of your favorite songs, statistics on global warming, the number of steps you took in a day. It should be in valid JSON. Use JSON Editor Online to check if your JSON is valid.
For an additional JSON example see this gist with weather data as well as the example files in the JSON folder for week 2.
public class SimpleJSON { | |
public static Object toJSON(Object object) throws JSONException { | |
if (object instanceof HashMap) { | |
JSONObject json = new JSONObject(); | |
HashMap map = (HashMap) object; | |
for (Object key : map.keySet()) { | |
json.put(key.toString(), toJSON(map.get(key))); | |
} | |
return json; |
import { Injectable } from '@angular/core'; | |
import { Http, Response } from '@angular/http'; | |
import 'rxjs/add/operator/map'; | |
@Injectable() | |
export class HerbsService { | |
private _url= 'assets/herbs.json'; | |
constructor(private _http: Http) {} | |
getHerbs () { | |
return this._http.get(this._url) | |
.map((response: Response) => response.json()); |