Skip to content

Instantly share code, notes, and snippets.

View MobliMic's full-sized avatar
:bowtie:
React.js init

Michael Craddock MobliMic

:bowtie:
React.js init
View GitHub Profile
@MobliMic
MobliMic / FunctionFunctionFunction.md
Last active January 2, 2016 02:59
Badger Badger Badger for Developers

Sung to the tune of Badger Badger Badger

Function Function Function Function Function Function Function Function Function Function Function Function

Variable Variable

A Function Function Function Function Function Function Function Function Function Function Function

Variable Variable

Keybase proof

I hereby claim:

  • I am moblimic on github.
  • I am moblimic (https://keybase.io/moblimic) on keybase.
  • I have a public key whose fingerprint is C8BD E7D9 57CF E0DF AD39 1CB4 1235 23BA 4BBA 9121

To claim this, I am signing this object:

@MobliMic
MobliMic / distance.js
Created April 12, 2016 13:56
distance functions
function deg2rad(deg) {
return deg * (Math.PI/180)
}
function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(lat2-lat1); // deg2rad below
var dLon = deg2rad(lon2-lon1);
var a =
Math.sin(dLat/2) * Math.sin(dLat/2) +
@MobliMic
MobliMic / led.js
Created March 23, 2017 10:31
led.js
// Importing packages
var fs = require('fs');
var util = require('util');
exec = require('child_process').exec;
// Set the Omega LED trigger to the specified mode
function setLed (triggerPath, triggerMode) {
fs.open(triggerPath, 'w', (err, fd) => {
fs.write(fd, triggerMode, () =>{
fs.close(fd);
@MobliMic
MobliMic / ari.js
Last active April 24, 2019 12:08
Readability score
(()=>{
var CHARACTER_WEIGHT = 4.71;
var SENTENCE_WEIGHT = 0.5;
var BASE = 21.43;
function automatedReadability(counts) {
if (!counts || !counts.sentence || !counts.word || !counts.character) {
return NaN;
}
/* eslint react/no-danger: 0 */
import React from "react";
import Document, { Html, Head, Main, NextScript } from "next/document";
import { ServerStyleSheet as StyledComponentSheets } from "styled-components";
class CustomDocument extends Document {
render() {
// Store initial props from request data that we need to use again on
// the client. See:
// https://github.com/zeit/next.js/issues/3043#issuecomment-334521241
import NextApp from 'next/app';
import React from 'react';
import { ThemeProvider } from 'styled-components';
const theme = {
primary: 'green'
};
export default class App extends NextApp {
// remove it here