Skip to content

Instantly share code, notes, and snippets.

View josiahwiebe's full-sized avatar

Josiah Wiebe josiahwiebe

View GitHub Profile
@josiahwiebe
josiahwiebe / validateVin.js
Created May 8, 2020 16:29
Validate VIN function
export const validateVin = value => {
if (value.length !== 17) return false
let chars = 'ABCDEFGHJKLMNPRSTUVWXYZ0123456789'
let nValue = new Array(
1,
2,
3,
4,
5,
@josiahwiebe
josiahwiebe / provinces_array.json
Last active November 8, 2019 15:47
JSON arrays of USA states and Canadian provinces, separated by country, combined and sorted, and combined and separated
[
"Alberta",
"British Columbia",
"Manitoba",
"New Brunswick",
"Newfoundland and Labrador",
"Northwest Territories",
"Nova Scotia",
"Nunavut",
"Ontario",
@josiahwiebe
josiahwiebe / api.js
Created February 9, 2018 15:50
Polka NextJS + API Example
const polka = require('polka')
module.exports = polka()
.get('/', (req, res) => {
res.end('this is the api')
})
@josiahwiebe
josiahwiebe / api.js
Created February 9, 2018 15:48
Express NextJS + API Example
const express = require('express')
const router = express.Router()
router.get('/', (req, res) => {
res.status(200).json({message: 'hello from api'})
})
module.exports = router
@josiahwiebe
josiahwiebe / all.txt
Last active December 15, 2017 18:10
LTV Travelers Clubs
Carolina LTV'ers
Great North East Travelers
Dixie Leisure Travelers
Southwest LTV Roadrunners
Leisurely Great Lakers
Heartland LTV'ers
Blue Ridge Leisures
Flamingles
Texoma Travelers
Midwest LTVers
@josiahwiebe
josiahwiebe / cors.js
Created September 29, 2016 15:17
CORS with ExpressJS
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET,OPTIONS')
res.header('Access-Control-Allow-Headers', 'content-Type, X-Requested-With')
next()
})
@josiahwiebe
josiahwiebe / cors.js
Created September 29, 2016 15:17
Cors with ExpressJS
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET,OPTIONS')
res.header('Access-Control-Allow-Headers', 'content-Type, X-Requested-With')
next()
})
@josiahwiebe
josiahwiebe / nz-2011.geojson
Created December 8, 2015 21:04
Photo locations from NZ trip in 2011
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@josiahwiebe
josiahwiebe / file.js
Created November 13, 2015 20:03
Make clicked nav item active while deactivating all others
$(document).ready(function() {
$('nav ul li').click(function(e) { // when clicking on the first level li
$('nav ul li div').removeClass('menu-is-visible'); // first remove the visible class any child div
$(this).children('div').addClass('menu-is-visible'); // then add the visible class to the current child div
});
});
@josiahwiebe
josiahwiebe / Gulpfile.js
Created June 3, 2015 15:23
Gulpfile with Sass error notify
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
watch = require('gulp-watch'),
notify = require('gulp-notify'),
browserSync = require('browser-sync').create()
sass = require('gulp-sass'),
neat = require('node-neat').includePaths;
var paths = {
scripts: ['_src/js/**/*.js', '!dist/js/**/*.js'],