Skip to content

Instantly share code, notes, and snippets.

View halfnibble's full-sized avatar
🎃
Coding

Josh Wedekind halfnibble

🎃
Coding
View GitHub Profile
@halfnibble
halfnibble / surveillance.js
Last active July 26, 2018 01:11
Test data for NSA hacking challege
var data = [
{
name: 'Bob Smith',
text: 'Hello, I want to eat a pineapple.'
},
{
name: 'Sally Smith',
text: 'I lit a firework, and it went kabooom!'
},
{
@halfnibble
halfnibble / Final_Exam_Part_2.php
Last active December 10, 2018 23:18
Part II of the Final Exam
<?php
/*
* Problem 01
* ==========
* Create an associative array with the following chart data and assign it to a variable named "$chartData".
* The data will be used later and accessed by date string, e.g. echo $chartData["201806"]; // expects 92000
*
* Monthly company revenue in USD. 201801: 154000, 201802: 165000,
* 201803: 120000, 201804: 130500,
* 201805: 110000, 201806: 92000,
@halfnibble
halfnibble / _grid.sass
Last active April 24, 2019 17:31
Sass Grid For Loop
@for $i from 1 through 12
.col-sm-#{$i}
@include sizer(small)
float: left
width: percentage(($i/12))
.col-md-#{$i}
@include sizer(medium)
float: left
width: percentage(($i/12))
.col-lg-#{$i}
@halfnibble
halfnibble / index.html
Created April 24, 2019 17:40
Menu HTML responsive nav
<body>
<nav>
<ul class="closed">
<li id="mobile-menu" class="mobile-only">
<a href="#">
<div id="hamburger"></div>
MENU
</a>
</li>
<li>
@halfnibble
halfnibble / main.js
Created April 24, 2019 17:41
Responsive nav jQuery code
$(document).ready(function() {
let menu = $('nav > ul'),
menuLink = $('#mobile-menu a');
menuLink.on('click', function() {
if (menu.hasClass('closed')) {
menu.removeClass('closed');
menu.addClass('open');
} else {
@halfnibble
halfnibble / main.scss
Created April 24, 2019 17:44
SCSS for responsive nav
@import "bourbon/bourbon";
@import "colors";
@import url('https://fonts.googleapis.com/css?family=Inconsolata');
@import "grid";
@import "utils";
$parent_menu_items: 3;
$submenu_menu_items: 4;
html, body {
@halfnibble
halfnibble / index.html
Created June 27, 2019 00:32
Example code so far.
<!DOCTYPE html>
<html>
<head>
<title>My JavaScript Test</title>
</head>
<body>
<h1 id="page-header">
Loading...
</h1>
@halfnibble
halfnibble / HashFunction.ts
Last active October 13, 2023 11:35
Hash function to debug absolute paths sent to the update chunk hash method in webpack.
import * as crypto from 'crypto';
import * as fs from 'fs';
import * as path from 'path';
/**
* Interface for Webpack's hashFunction
*/
export interface IHashFunction {
update: (data: string | Buffer, encoding: string) => IHashFunction;
digest: (encoding: string) => string | Buffer;
@halfnibble
halfnibble / htmlToAST.js
Last active December 27, 2021 14:59
GraphCMS HTML to RichTextAST
const { jsx } = require('slate-hyperscript')
const { JSDOM } = require('jsdom')
const DOMParser = new JSDOM().window.DOMParser
/**
* Parses and returns a Rich Text AST object for use in GraphCMS.
*
* @param {HTML} html string, e.g. `<p>hi there</p>`
*/
const htmlToAST = html => {
@halfnibble
halfnibble / webpack.config.js
Created June 22, 2020 17:23
Add file-loader to webpack config.
const path = require('path')
const ExtractTextWebpackPlugin = require('extract-text-webpack-plugin')
const { postLogin, postArticle } = require('./js/api')
const express = require('express')
module.exports = {
mode: 'development',
entry: {
'app': './js/index.js',
'styles': './sass/styles.sass'