Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block townivan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
townivan / local-php-on-mac.txt
Created Aug 22, 2019
Run php locally on mac
View local-php-on-mac.txt
php -S
townivan / find-that-object.js
Created Aug 16, 2019
Get a matching object from an array of objects with a specific value for a property
View find-that-object.js
thingArray.filter(thing => (thing.Name === "Larry"));
townivan / .htaccess
Created Jul 15, 2019
htaccess which redirects http://domain, https://domain, http://www.domain to https://www.domain
View .htaccess
# if host contains www - skip redirect to www
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .? - [S=1]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# redirect all to https
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
townivan / gulpfile.esm.js
Created May 31, 2019
Gulp4 gulpfile w/ basic browserSync+sass. This uses es6 modules via the esm package, hence the .esm.js extension
View gulpfile.esm.js
// renames to gulpfile.esm.js to use the esm package support of es6 module 'import' syntax
import gulp from 'gulp';
import sass from 'gulp-sass';
import browserSync from 'browser-sync';
const myGlobs = {
scssSource: './app/scss/**/*.scss', // includes .scss files in any subfolders of ./scss also
cssDest: './app/css',
htmlSource: './app/*.html',
townivan / stuff.js
Created Jan 8, 2019
Read all of the .html files in a folder without using a library like glob
View stuff.js
const fs = require('fs');
const targetPath = './src/pages/'
// *.html files
let fileNamesArray = fs.readdirSync(targetPath).filter( (file) => {
return file.includes('.html')
// 'all-comps.html', 'c090.html', 'c100.html', 'c101.html', 'c102.html', 'index.html' ]
View favicon-chrome-error-quick-fix.html
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<!-- credit: -->
townivan / basic.html
Created Nov 7, 2018
standard html page setup
View basic.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
townivan / online-keyboard-only.html
Last active Nov 14, 2018
outline style only for keyboard
View online-keyboard-only.html
// Let the document know when the mouse is being used
document.body.addEventListener('mousedown', function() {
document.body.addEventListener('keydown', function() {
townivan / color object
Created Sep 13, 2018 — forked from OneCent01/color object
Every color contained in an object with its corresponding hexa value for O(1) time lookup, find function below object
View color object
var colors = {
AQUA: '#00FFFF',
BLACK: '#000000',
townivan / export-errors
Created May 18, 2018
Export errors from HTML_CodeSniffer.
View export-errors
Array.from(document.querySelectorAll(".HTMLCS-issue-detail-list li")).map((el) => { return { detail: el.querySelector(".HTMLCS-issue-title").textContent, code: el.querySelector(".HTMLCS-issue-source-inner strong").textContent } })
You can’t perform that action at this time.