Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/** | |
* HmacSHA512 | |
* | |
* @see <http://drumcoder.co.uk/blog/2011/apr/21/calculate-hmac-hash-java/> | |
* @param String value | |
* @param String secret | |
* @return String | |
*/ | |
private String buildHmacSignature(String value, String secret) { | |
String result; |
package com.example.wear; | |
import android.app.Activity; | |
import android.hardware.Sensor; | |
import android.hardware.SensorEvent; | |
import android.hardware.SensorEventListener; | |
import android.hardware.SensorManager; | |
import android.os.Bundle; | |
import android.support.wearable.view.WatchViewStub; | |
import android.util.Log; |
open System | |
module AsyncExt = | |
open System.Threading | |
let choice workflows = | |
Async.FromContinuations(fun (cont, _, _) -> | |
let cts = new CancellationTokenSource() | |
let completed = ref false | |
let lockObj = new obj() | |
let synchronized f = lock lockObj f |
/** | |
* HmacSHA512 | |
* | |
* @see <http://drumcoder.co.uk/blog/2011/apr/21/calculate-hmac-hash-java/> | |
* @param String value | |
* @param String secret | |
* @return String | |
*/ | |
private String buildHmacSignature(String value, String secret) { | |
String result; |
#dart:convert example
How to pretty-print JSON using Dart.
How to display JSON in an easy-to-read (for human readers) format.
Main library: dart:convert
Main element: JsonEncoder.withIndent
Gist: https://gist.github.com/kasperpeulen/d61029fc0bc6cd104602
# This is just a cheat sheet: | |
# On production | |
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
# On local | |
scp -C production:~/database.sql.gz | |
dropdb database && createdb database | |
gunzip < database.sql.gz | psql database |
curl -i -H 'Content-type: application/json' -H 'Authorization: key=<your_server_key>' -XPOST https://fcm.googleapis.com/fcm/send -d '{ | |
"registration_ids":["registration_ids", "of the", "target", "devices as array"], | |
"notification": { | |
"title":"Title of your notification", | |
"body":"content of your notification" | |
}, | |
"data": { | |
"key1" : "value1", | |
"key2" : "value2", | |
"key3" : 23.56565, |
import 'dart:math' as math; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/src/rendering/sliver.dart'; | |
import 'package:flutter/src/rendering/sliver_grid.dart'; | |
class _CoordinateOffset { | |
final double main, cross; | |
_CoordinateOffset(this.main, this.cross); | |
} |