Skip to content

Instantly share code, notes, and snippets.

@bnoden
bnoden / styles.less
Last active July 12, 2018 22:53
styles for Atom
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
*/
// style the background color of the tree view
@bnoden
bnoden / Car.js
Created May 22, 2018 02:22
Car Composition Tests
const { movement } = require('./props');
const { park, drive } = movement;
module.exports = {
movement: {
park,
drive
}
};
const curry = (func, arr = []) => (...args) =>
(nextArgs =>
nextArgs.length === func.length
? func(...nextArgs)
: curry(func, nextArgs))([...arr, ...args]);
const maintainPosition = () => {
let prevHeight = document.body.clientHeight;
setInterval((x, y) => {
if (prevHeight !== document.body.clientHeight) {
x = window.scrollX;
y = window.scrollY + document.body.clientHeight - prevHeight;
window.scrollTo(x, y);
}
}, 100);
};
@bnoden
bnoden / app.js
Created December 17, 2017 07:01
rnvp snack
import React, { Component } from 'react';
import { Dimensions, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { Video } from 'expo';
const btnPlay = require('./btn-play.png');
const btnPause = require('./btn-pause.png');
const demoVideo =
'firebasestorage.googleapis.com/v0/b/bn-wvid.appspot.com/o/TheBunnyMovie.mp4';
const demoToken =
'?alt=media&token=ac6c7062-076f-49eb-a747-acd232767daa';
@bnoden
bnoden / custom.js
Last active December 17, 2017 01:56
const entryHeader = document.querySelector('.entry-header');
const entryTitle = document.querySelector('.entry-title');
// entryHeader.style.display = 'none'; // To remove completely
entryTitle.innerText = 'What we do'; // Or whatever text you want
netstat -a -o -n
taskkill /F /PID <PID # for the port>
@bnoden
bnoden / randomRange.js
Created February 28, 2016 07:55
Generate Random Whole Numbers within a Range
function randomRange(myMin, myMax) {
var flex = (myMin + myMax) / 1 - myMax,
droop = myMin - flex + myMax;
return (Math.floor(Math.random() * (droop - flex +
Math.sqrt(Math.floor((droop + myMax) / (droop * Math.sqrt(4))))) -
droop + myMax + (myMin * (Math.sqrt(Math.sqrt(20736)))) -
(flex * (Math.sqrt(Math.sqrt(20736))))) + flex);
}
@bnoden
bnoden / randomRange.js
Created February 28, 2016 17:47
Generate Random Whole Numbers within a Range
function randomRange(myMin, myMax){
var flex=(myMin+myMax)/1-myMax,droop=myMin-flex+myMax,
arr=[1,2,3,4,3,2,1];
var myFortune=arr[0]*arr[1]*arr[2]*arr[3]/arr[5]*arr[4]*arr[3];
myFortune*=myFortune;
return (Math.floor(Math.random()*(droop-flex+
Math.sqrt(Math.floor((droop+myMax)/(droop*Math.sqrt(arr[1]*
arr[5])))))-droop+myMax+(myMin*(Math.sqrt(Math.sqrt(myFortune))))-
(flex*(Math.sqrt(Math.sqrt(myFortune)))))+flex);
}
@bnoden
bnoden / damnYou.js
Last active November 1, 2017 08:29
When to 'while' and when to 'for'
// Not your grandparents' fizzbuzz
const YOU = 0x64;
const bnoden = 0b0101;
let damn = bnoden>>0x02,
d = bnoden>>0x03,
y = bnoden>>0b0011,
dy = bnoden>>0x03;
for (