Skip to content

Instantly share code, notes, and snippets.

View jaywon's full-sized avatar

Jason Sewell jaywon

View GitHub Profile
@jaywon
jaywon / history.js
Created September 11, 2015 21:13
LinkedListExample
var inputText = null;
var historyText = null;
var ll = linkedListGenerator();
function addToList(){
console.log('adding');
var saveValue = document.getElementById('textBox1').value;
ll.add(saveValue);
}
@jaywon
jaywon / logic.md
Last active July 9, 2016 08:09
Logic

If statements

If statments are a way for our applications to take different paths through our code or make choices about what kind of behavior our application takes based on certain conditions or values in our variables. The variable or value that we are testing to be true is known as the condition.

In Human: If this condition is true, do something.

var isTurnedOn = false;
function flipSwitch(){
  if(isTurnedOn){
 isTurnedOn = false;
@jaywon
jaywon / app.html
Created September 17, 2015 11:37
Vertical Mixer Effect - Snap.svg
<svg>
<line fill="none" stroke="#008D36" stroke-width="15" x1="175" y1="153" x2="175" y2="21" id="Line"/>
</svg>
@jaywon
jaywon / install-comodo-ssl-cert-for-nginx.rst
Created October 19, 2015 02:22 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@jaywon
jaywon / server.js
Created October 28, 2015 22:09
Basic middleware flow for Express 4
var express = require('express');
var app = express();
// app.locals.myIp = 123.234.44.23;
app.use(function handler1(req, res, next){
console.log('res.locals', res.locals);
res.locals.myName = 'Jason';
next();
});
@jaywon
jaywon / server.js
Created October 28, 2015 22:28
Middleware Cookie Handling in Express 4
var express = require('express');
var app = express();
var cookieParser = require('cookie-parser');
// app.locals.myIp = 123.234.44.23;
app.use(cookieParser());
// if cookie doesn't exist, set cookie
app.use(function(req, res, next){
var cookie = req.cookies.myTrackingCookie;
@jaywon
jaywon / z_collection-hooks-stub.js
Created November 7, 2015 23:25
A mock for the Meteor smart package collection-hooks. Add this file in the folder tests/jasmine/server/unit/
var originalMeteorCollection = Meteor.Collection;
Meteor.Collection = function () {
var collectionHooks = {
before: {
insert: [],
update: [],
remove: []
},
after: {
var w = 1280,
h = 800;
var projection = d3.geo.azimuthal()
.mode("equidistant")
.origin([-98, 38])
.scale(1400)
.translate([640, 360]);
@jaywon
jaywon / job-import.js
Created November 10, 2015 22:16
CSV import utility for Node
var fs = require('fs');
var csv = require('fast-csv');
var stream = fs.createReadStream('/home/jaywon/Downloads/modified-salary-per-state-per-jobtitle.csv');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var masterList = [];
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/job-imports');
//define schema for import data
@jaywon
jaywon / functions.md
Last active November 27, 2023 04:15 — forked from sgnl/functions.md
Functions

Functions

Functions are great, they take data (input), do stuff with that data and then return it to you all shiny and fancy (output).

Below are some specifications for Functions to be built.

Declare Two Variables

  • a random Number value
  • b random Number value

We will be using both of these variables to pass as parameters to the following functions that we will write. Pay close attention to the other variable names you will create as they will become input to other functions.