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 / 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 / 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 / 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 / _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 / 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 / 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 / gist:aa21419dbc54ca698f88d1011835673a
Created July 16, 2018 22:58
Secret decoding in JavaScript
// Caesar cipher +2
var encoded_caesar = "vjg"tckp"kp"urckp"hcnnu"ockpn{"qp"vjg"rnckp";
// Divisible by 2: +1, Divisible by 3: +3, Divisible by both: -1
var fancy_cipher = "shf#ne`njqh nf!ojfd jv!41";
@halfnibble
halfnibble / gist:bb24c8d3efa51266d3263a77ca20c523
Last active January 26, 2018 00:25
Apache 2.4 compression settings for virtual host
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/xml
</IfModule>
@halfnibble
halfnibble / cleandump.py
Created August 30, 2016 05:27
Django Management Command to Create Clean Fixtures
# Place in /installed_app/management/commands/cleandump.py
import os
from django.core import management
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Creates clean dumpdata fixtures.'
@halfnibble
halfnibble / loadModule.js
Created July 28, 2016 07:35
In case you want to include a function or variable eliminated by Rollup.js treeshaking.
export var loadModule = function(module) {
// Trick Rollup.js to keep JavaScript.
let obj = {
method: function() {}
};
obj.method(module);
};
/* Example usage