Skip to content

Instantly share code, notes, and snippets.

@JoeShep
JoeShep / GULP.md
Created April 25, 2016 22:14
Simple Gulp jshint watcher

Install required NPM modules in the directory

npm install gulp jshint gulp-jshint jshint-stylish gulp-watch

Create your gulpfile.js and paste in the following code

var gulp = require('gulp');
@JoeShep
JoeShep / index.html
Created May 9, 2016 15:42
jQuery Playground
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<h3>A list of things</h3>
@JoeShep
JoeShep / main.js
Created June 8, 2016 15:02
Sandwich Maker example
console.log(Sandwich);
var sandwichCost = Sandwich.getSandwichPrice("cheese");
var toppingCost = Sandwich.getToppingPrice("captainCrunch");
var output = document.getElementById("sandwich");
output.innerHTML = sandwichCost + toppingCost;
@JoeShep
JoeShep / index.html
Created June 20, 2016 16:12
jQuery Intro
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<h3>A list of things</h3>
{
"name": "hbs_browserify-grunt",
"version": "0.1.0",
"devDependencies": {
"browserify": "^13.0.0",
"grunt": "^0.4.5",
"grunt-browserify": "^5.0.0",
"grunt-contrib-handlebars": "^1.0.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-nodeunit": "~0.4.1",
module.exports = function(grunt) {
grunt.initConfig({
// Change the b-fy task to add a transform task
browserify: {
js: {
src: ['./js/main.js'],
dest: 'dist/app.js'
},
options: {
@JoeShep
JoeShep / functions.js
Created October 17, 2016 15:39
Functions intro
// Performs an action, but caluculates/returns no value
// console.log(returnNothing());
var returnNothing = function() {
console.log("I don't return anything");
};
// returnNothing();
// Does a task and returns the result of that task
var result = addStuff();
@JoeShep
JoeShep / index.html
Last active October 17, 2016 22:19
Event Listeners intro
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nashville Software School</title>
<link rel="stylesheet" type="text/css" href="events.css">
</head>
<body>
@JoeShep
JoeShep / properties.js
Created November 5, 2016 19:30 — forked from seanspradlin/properties.js
Object properties tutorial
function Person(firstName, lastName, age, ssn) {
// Declaring this way by default will make your property
// readable, writable, and enumerable
this.firstName = firstName;
this.lastName = lastName;
// Let's make a getter-only method that returns the
// two values as a whole name
Object.defineProperty(this, 'fullName', {
get: function() {
@JoeShep
JoeShep / main.js
Created March 14, 2017 20:42
Mocha: Testing with Promises
'use strict';
const sqlite3 = require('sqlite3');
const db = new sqlite3.Database('./acme.sqlite', (wat) => {
console.log("Is this connection open?", wat);
});
const getCustomer = (custPhone) => {
return new Promise( (resolve, reject) => {
db.get(`SELECT first_name, last_name FROM customers WHERE phone = "${custPhone}"`, (err, customer) => {