Skip to content

Instantly share code, notes, and snippets.

@amogower
amogower / .htaccess
Created February 4, 2018 18:03
HTML5 Boilerplate htaccess file
# Apache Server Configs v2.15.0 | MIT License
# https://github.com/h5bp/server-configs-apache
# (!) Using `.htaccess` files slows down Apache, therefore, if you have
# access to the main server configuration file (which is usually called
# `httpd.conf`), you should add this logic there.
#
# https://httpd.apache.org/docs/current/howto/htaccess.html
# ######################################################################
@amogower
amogower / index.js
Created February 12, 2018 15:44
Tribonacci Sequence with Recursion
function tribonacci(signature, n) {
if (n <= 3) {
return signature.length === 3 ? signature.slice(0, n) : signature;
}
const numbers = n < 3 ? signature.slice(0, n) : signature.slice(-3);
const sum = numbers.reduce((acc, curr) => acc + curr);
return tribonacci([...signature, sum], n - 1);
}
@amogower
amogower / Base.js
Created February 19, 2018 14:56
Base Class for JavaScript Inheritance
/*
Base.js, version 1.1a
Copyright 2006-2010, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
var Base = function() {
// dummy
};
Verifying my Blockstack ID is secured with the address 1yJtpM1dKRx3Ls6XWk785iwrvCCi216od https://explorer.blockstack.org/address/1yJtpM1dKRx3Ls6XWk785iwrvCCi216od
@amogower
amogower / converts-webfont-to-base64.js
Created May 6, 2018 16:44 — forked from arielsalminen/converts-webfont-to-base64.js
Convert Google WOFF font to base64 format and inline to <head> of document
// Get binary file using XMLHttpRequest
function getBinary(file) {
var xhr = new XMLHttpRequest();
xhr.open("GET", file, false);
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.send(null);
return xhr.responseText;
}
// Base64 encode binary string
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Check Test Benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@amogower
amogower / settings.json
Created October 1, 2018 07:51
VS Code Settings
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Liga Dank Mono",
// "editor.fontFamily": "Operator Mono Lig",
// "editor.fontFamily": "Fira Code",
// "editor.fontWeight": "400",
"editor.fontSize": 14,
"editor.fontLigatures": true,
"window.zoomLevel": -1,
"editor.minimap.enabled": true,
@amogower
amogower / custom-vscode-workbench-styling.json
Created January 14, 2019 20:35
Custom VSCode Workbench Styling
{
"workbench.colorCustomizations": {
"sideBar.background": "#16232A",
"activityBar.background": "#16232A",
"activityBar.border": "#3C3C3C",
"activityBarBadge.background": "#ffc02d",
"activityBarBadge.foreground": "#16232A",
"input.background": "#16232A",
"tab.inactiveForeground": "#AAAAAA",
"tab.activeBackground": "#303D46",
@amogower
amogower / machine.js
Last active August 30, 2019 13:38
Generated by XState Viz: https://xstate.js.org/viz
const isEmail = (email) => email.indexOf('@') > -1;
const machine = Machine({
id: 'myoc',
context: {
hasAcceptedNewsletter: false,
hasAcceptedTerms: false,
email: '',
password: '',
stayLoggedIn: false,
@amogower
amogower / machine.js
Created September 7, 2019 09:26
Generated by XState Viz: https://xstate.js.org/viz
const isEmail = (email) => email.indexOf('@') > -1;
const machine = Machine({
id: 'betslip',
context: {
selectedBets: {},
selectedBetsOddsTotals: {},
freebetCache: {},
stakes: {
multiples: [],