This tutorial shows how to make backups to Google Cloud Storage. The backups are:
- automatic
- stored off site
- incremental
var food = [ | |
{name: “Lettuce”, category: “Vegetable”}, | |
{name: “Apple”, category: "Fruit"}, | |
{name: "Orange", category: "Fruit"}, | |
{name: "Potato", category: "Vegetable"} | |
]; |
import { AsyncStorage } from 'react-native'; | |
const JSONAsyncStorage = Object.assign({}, AsyncStorage, { | |
getItem() { | |
return AsyncStorage.getItem.apply(null, arguments).then((res) => JSON.parse(res)); | |
}, | |
setItem(key, value) { | |
return AsyncStorage.setItem(key, JSON.stringify(value)) | |
} | |
}); |
/* | |
* Android API Guide | |
* http://developer.android.com/guide/topics/ui/actionbar.html | |
* Android Design Guide | |
* http://developer.android.com/design/patterns/actionbar.html | |
* Titanium Mobile will support someday | |
* https://jira.appcelerator.org/browse/TIMOB-2371 | |
*/ | |
var osName = Ti.Platform.osname, | |
isAndroid = osName==='android', |
<?php | |
class TransformerAbstract | |
{ | |
private $fields; | |
private $allowedFields = array('id', 'name', 'phone', 'email', 'bio', 'num_friends'); | |
private $partialFields = array( | |
'id' => array('id', 'name'), | |
'info' => array('name', 'phone', 'email', 'bio'), | |
'bio' => array('bio') |
import UIKit | |
/** | |
Swizzles `addSubview` of `UIView`, replacing it with an implementatio that ensures it is always | |
invoked on the main thread. | |
Call this method in your application entry point, e.g. the `UIApplicationDelegate`. | |
*/ | |
func swizzleAddSubview() { | |
let clazz = UIView.self |
Terminal Commands: | |
One webcam: | |
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -threads 6 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAMNAMEHERE | |
Two webcam overlay: | |
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video1 -f v4l2 -s 320x240 -r 10 -i /dev/video0 -filter_complex "[1:v]setpts=PTS-STARTPTS[bg]; [2:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=shortest=1 [out]" -map "[out]" -map 0:a -vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -threads 6 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAMNAMEHERE |
# How to echobot with XMPP, BOSH, and Strophe | |
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local | |
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this | |
#/etc/hosts | |
127.0.0.1 localhost.local | |
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server. | |
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0) |
<!doctype html> | |
<html> | |
<head> | |
<script> | |
//This plays a file, and call a callback once it completed (if a callback is set) | |
function play(audio, callback) { | |
audio.play(); | |
if (callback) { |
import React from 'react' | |
const CountDownTimer = ({hoursMinSecs}) => { | |
const { hours = 0, minutes = 0, seconds = 60 } = hoursMinSecs; | |
const [[hrs, mins, secs], setTime] = React.useState([hours, minutes, seconds]); | |
const tick = () => { | |