Testing the DeviceOrientation API
Test case: http://jsfiddle.net/TPz2G/3/show/
- Alpha increases when rotating device clockwise
absolute
: true
const ReactDom = require('react-dom'); | |
const { Router } = require('react-router'); | |
const { createHistory } = require('history'), | |
history = createHistory(); | |
const mount = window.document.getElementById('app'); | |
if (!mount){ | |
mount = window.document.createElement("div"); | |
mount.id = "app"; | |
window.document.body.appendChild('mount'); |
import React from 'react'; | |
import mui from 'material-ui'; | |
import injectTapEventPlugin from 'react-tap-event-plugin'; | |
import ThemeManager from 'material-ui/lib/styles/theme-manager'; | |
import Colors from 'material-ui/lib/styles/colors'; | |
import MyTheme from './theme.js'; | |
import AppBar from 'material-ui/lib/app-bar'; | |
import List from 'material-ui/lib/lists/list'; | |
import ListItem from 'material-ui/lib/lists/list-item'; |
var tilt = { | |
alpha: 0, | |
beta: 0, | |
gamma: 0 | |
}; | |
function lowPass(prev, curr, co) { | |
return prev * co + curr * (1 - co); | |
} |
const pop = (array) => array.splice(0, -1); | |
const push = (array, el) => [...array, el]; | |
const splice = (array = [], startCount, deleteCount = 0, ...elements) => { | |
const { length } = array; | |
let remainder = startCount + deleteCount; | |
if(startCount > length || startCount <= -length) { | |
startCount = 0; |
absolute
: true/** | |
* Inspired by "MyASUS - ASUS support" version 2016 https://play.google.com/store/apps/details?id=com.asus.ia.asusapp | |
* Colors: https://material.google.com/style/color.html#color-color-palette | |
* | |
* See online - https://rnplay.org/apps/7qet3A | |
*/ | |
import React, { Component, } from 'react'; | |
import { | |
AppRegistry, |
// ES7, async/await | |
function sleep(ms = 0) { | |
return new Promise(r => setTimeout(r, ms)); | |
} | |
(async () => { | |
console.log('a'); | |
await sleep(1000); | |
console.log('b'); | |
})() |
{ | |
"auto_complete_commit_on_tab": true, | |
"color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme", | |
"draw_white_space": "all", | |
"font_face": "Fira Mono", | |
"font_size": 20, | |
"tab_size": 2, | |
"theme": "Brogrammer.sublime-theme", | |
"translate_tabs_to_spaces": true, | |
"trim_automatic_white_space": true, |
// Firebase Batch Functions Deploy (Alisson Enz) | |
// This script helps firebase users deploy their functions when they have more than 60 functions and | |
// it's not allowed to deploy all using `firebase deploy --only functions` due deployment quota. | |
// This script will get your functions export from index.js and deploy in batches of 30 and wait 30 seconds. | |
// This script will NOT delete your function when removed from index.js. | |
// Instructions | |
// 0. This instructions suppose that you already have firebase-tools installed and is logged to your account; | |
// 1. Install `shelljs` (npm install -g shelljs); |
Want to quickly find your regrettable 10 year old tweets without having to learn how to use the twitter API or scroll manually through the infinite ether of the bad takes you've tweeted throughout the ages?
Then this is for you, ya lazy human. Just paste in the console and watch those hot takes go by.
function autoScrolling() {
window.scrollTo(0,document.body.scrollHeight);
}