Skip to content

Instantly share code, notes, and snippets.

View EdwardNavarro's full-sized avatar
🎯
Focusing

Edward Navarro EdwardNavarro

🎯
Focusing
View GitHub Profile
@darylrowland
darylrowland / fruitarray.js
Created January 11, 2016 12:01
Medium article on ListViews in ReactNative
var food = [
{name: “Lettuce”, category: “Vegetable”},
{name: “Apple”, category: "Fruit"},
{name: "Orange", category: "Fruit"},
{name: "Potato", category: "Vegetable"}
];
@rohozhnikoff
rohozhnikoff / storage.js
Last active August 31, 2018 08:23
[react-native] wrapped AsyncStorage with JSON support
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))
}
});
@Mode54
Mode54 / ActionBarView.js
Created July 22, 2012 16:00
Action Bar Module for Titanium Mobile
/*
* 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')
@Nillerr
Nillerr / UIView+MainThread.swift
Last active February 26, 2022 05:46
Replaces a call to *addSubview* with an implementation that ensures it is always invoked on the main thread.
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
@laurenarcher
laurenarcher / livestreamingyoutube
Created November 21, 2014 14:13
Livestreaming to Youtube Live, Ubuntu, Linux FFMPEG
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
@rnwolf
rnwolf / 1_google_cloud_storage_backup_tutorial.md
Created July 7, 2017 18:45
Tutorial shows how to make backups to Google Cloud Storage.

Google Cloud Storage backup tutorial

Introduction

This tutorial shows how to make backups to Google Cloud Storage. The backups are:

  • automatic
  • stored off site
  • incremental
# 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)
@yuraloginoff
yuraloginoff / html5 audio queue
Last active July 25, 2022 05:55
html5 audio queue
<!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 = () => {