Skip to content

Instantly share code, notes, and snippets.

View joshblack's full-sized avatar

Josh Black joshblack

View GitHub Profile
@joshblack
joshblack / flashcards.rb
Created March 5, 2014 07:20
Simple Flashcard Demonstration, learning Ruby syntax.
module Flashcards
class Application
def initialize
@decks = []
end
def << deck
@decks << deck
end
@joshblack
joshblack / Simple LESS Gruntfile
Created March 24, 2014 23:43
Simple LESS configuration for Grunt
'use strict';
module.exports = function (grunt) {
// Load our grunt tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.initConfig({
watch: {

Squarespace Background Effect

Trying to mimic Squarespace's current background effect where it follows the motion of your mouse

A Pen by Josh Black on CodePen.

License.

@joshblack
joshblack / courseParser.js
Created April 14, 2014 19:01
Parse the UF Course Registrar page for course data
var Crawler = require("crawler").Crawler,
fs = require('graceful-fs'),
courseDictionary = require('./courseDictionary.json'),
buildingDictionary = require('./buildingDictionary.json'),
i = 1,
request = 0;
var c = new Crawler({
"maxConnections": 1, // Set to one so we don't run into concurrency issues when it comes to
// writing to our result files
<?php
class DB {
/**
* The PDO object
*
* @var object
*/
private $pdo;
@joshblack
joshblack / flashcards.js
Last active August 29, 2015 14:01
JavaScript implementation of Flashcards program
// Require our node module to read user input from STDIN and STDOUT
var readline = require('readline'),
rl = readline.createInterface(process.stdin, process.stdout),
user = new User();
// Write our intro messages
process.stdout.write("Welcome to the flashcard application!\n");
process.stdout.write("What would you like to do?\n");
// Setup the prompt style
@joshblack
joshblack / flashcards_walkthrough.js
Created May 19, 2014 13:47
Walkthrough of developing flashcards.js for Web Dev Workshops
// First thing that we will need to set up are our dependencies for the application.
// Since we are using Node.js we need to utilize it's readline module to take in input
// from STDIN as well as output to STDOUT.
// 1. Import our dependencies
var readline = require('readline'),
rl = readline.createInterface(process.stdin, process.stdout);
// In the above code I've required the readline module and created its interface that
// allows us to read input from the command line as well as send output to the command line.
@joshblack
joshblack / diff.js
Last active November 7, 2021 12:23
Find the difference between two DOM NodeLists
// Takes in two node lists, i.e:
// var orig = document.getElementsByTagName('*'); -> original DOM Tree
// var update = document.getElementsByTagName('*'); -> updated DOM Tree
// diff(orig, update); -> should return the affected nodes (deleted or added)
function diff(original, updated) {
// Create arrays from our two node lists.
var originalList = [].slice.call(original, 0),
updatedList = [].slice.call(updated, 0),
@joshblack
joshblack / minix.md
Last active August 29, 2015 14:06
Mount MINIX3 Files
var timeSyntaxRules = {
1: function (time) {
// Check to see if first digit is not 1, then preface it with zero
var pattern = /[2-9]/;
if (time.match(pattern)) {
return "0" + time;
}