Skip to content

Instantly share code, notes, and snippets.

View jasan-s's full-sized avatar

Jasan jasan-s

View GitHub Profile
@puppybits
puppybits / index.js
Created September 15, 2016 00:59
Rough minimal bootstrap for React w/ code splitting
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';
@MylesBorins
MylesBorins / low-pass-device.js
Created April 15, 2016 16:15
Low pass filter of device orientation
var tilt = {
alpha: 0,
beta: 0,
gamma: 0
};
function lowPass(prev, curr, co) {
return prev * co + curr * (1 - co);
}
@cameronbourke
cameronbourke / immutable-array-methods.es6.js
Last active October 30, 2016 08:29
After watching Dan Abramov's egghead series on Redux, https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree, I quickly played around with how native array methods in javascript could be immutable. This is focused on the methods not like map, reduce, filter etc which already don't mutate the array.
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;
@mattdsteele
mattdsteele / gist:5615925
Last active October 30, 2016 12:18
Quirks in DeviceOrientation API
@tackkinc
tackkinc / index.android.js
Created July 9, 2016 02:32 — forked from nidorx/index.android.js
React Native - Section ListView with search input
/**
* 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,
@danharper
danharper / 1-sleep-es7.js
Created February 8, 2015 16:55
ES7's async/await syntax.
// 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,
@AlissonEnz
AlissonEnz / functionsDeploy.js
Created March 18, 2020 00:00
Firebase Batch Deploy Functions
// 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);
@duncangh
duncangh / readme.md
Last active March 14, 2022 03:36
Scroll to bottom of *infinite* timeline Javascript

Autoscroll Twitter Timeline

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);
}