Skip to content

Instantly share code, notes, and snippets.

View nelsonJM's full-sized avatar

Josh Nelson nelsonJM

View GitHub Profile
@nelsonJM
nelsonJM / machine.js
Last active April 22, 2020 12:10
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@nelsonJM
nelsonJM / machine.js
Created January 4, 2020 06:47
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@nelsonJM
nelsonJM / gist:7832699
Created December 6, 2013 21:49
Grunt: Package.json example
{
"name": "steelsentry-theme",
"author": "josh",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-contrib-imagemin": "~0.3.0",
@nelsonJM
nelsonJM / gist:7832678
Created December 6, 2013 21:47
Grunt: Gruntfile.js example
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {
static: {
options: {
optimizationLevel: 3
},
files: {
'pbimages/pegboard-2424.jpg': 'img_src/pbimages/pegboard-2424.jpg'
@nelsonJM
nelsonJM / gist:7832667
Created December 6, 2013 21:47
COMPASS: Config.rb example
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
fonts_dir = "fonts"
@nelsonJM
nelsonJM / cookie_util.js
Created December 5, 2013 20:34
JS: Cookie Util
@nelsonJM
nelsonJM / gist:7760968
Created December 2, 2013 23:22
JS: Quiz
EventUtil.addHandler(window, "load", function() {
var question1 = {
question: "What's Josh's favorite color?",
choices: ["red", "green", "blue"],
correctAnswer: 1
},
question2 = {
question: "What's Josh's favorite animal?",
@nelsonJM
nelsonJM / gist:7753802
Created December 2, 2013 18:13
JS: Serialization
// Form Serialization
function serialize(form) {
var parts = [],
field = null,
i,
len,
j,
optLen,
option,
optValue;
@nelsonJM
nelsonJM / gist:7667478
Created November 26, 2013 22:29
JS: JS for PWD example work
// Chapter 13
// Doesn't work
// var image = document.getElementById("10-Reasons");
// EventUtil.addHandler(image, "load", function(event){
// event = EventUtil.getEvent(event);
// alert(EventUtil.getTarget(event).src);
// });
// works!
@nelsonJM
nelsonJM / js_example.js
Created November 26, 2013 21:36
JS: JS for Pro Web Dev Examples
// Chapter 13
// Doesn't work
// var image = document.getElementById("10-Reasons");
// EventUtil.addHandler(image, "load", function(event){
// event = EventUtil.getEvent(event);
// alert(EventUtil.getTarget(event).src);
// });
// works!