Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Busy Coding...

Christopher Vachon CodeVachon

:octocat:
Busy Coding...
View GitHub Profile
@CodeVachon
CodeVachon / response.json
Last active Sep 2, 2019
GET:/rest/books/
View response.json
// GET:/rest/books/
[
{
"id": "IaNFbTL33g",
"title": "Thrawn",
"deck": "In this definitive novel, readers will follow Thrawn’s ...",
"language": "english",
"coverImage": "/images/91SxgwHMc0L.jpg",
"publishDate": "2017-04-11",
"created": "...",
@CodeVachon
CodeVachon / middleware-test.js
Last active Aug 15, 2019
express middleware mocha test
View middleware-test.js
var middleware = require('middleware'), // the Middleware you want to test
httpMocks = require('node-mocks-http'), // quickly sets up REQUEST and RESPONSE to be passed into Express Middleware
request = {}, // define REQUEST
response = {} // define RESPONSE
;
describe('Middleware test', function(){
context('Valid arguments are passed', function() {
beforeEach(function(done) {
/*
@CodeVachon
CodeVachon / compiled.css
Created May 15, 2019
My SCSS respondTo media query mixin
View compiled.css
.profile .title {
font-size: 1.6rem;
font-weight: bold;
}
@media screen and (min-width: 0) and (max-width: 1087px) {
.profile .title {
font-size: 1.3rem;
}
}
@CodeVachon
CodeVachon / gulpfile.babel.js
Last active Nov 25, 2017
React Setup with Babel, Gulp, and Browserify
View gulpfile.babel.js
import gulp from 'gulp';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import eslint from 'gulp-eslint';
import exorcist from 'exorcist';
import browserSync from 'browser-sync';
import watchify from 'watchify';
import babelify from 'babelify';
import uglify from 'gulp-uglify';
View CircleGauge.jsx
import React from 'react';
export default class CircleGauge extends React.Component {
constructor(props) {
super(props);
this.state = {};
} // close constructor
render () {
@CodeVachon
CodeVachon / kettleTemp.ino
Created Dec 1, 2016
A State Machine for my Arduino Beer Kettle Temperature Display
View kettleTemp.ino
// LCD SHIELD
// include the library code:
#include <Wire.h>
#include <utility/Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#define OFF 0x0
#define RED 0x1
#define YELLOW 0x3
@CodeVachon
CodeVachon / index.js
Created Mar 4, 2016
How to Modify a DoubleClick Advertisement
View index.js
$(document).ready(function() {
/*
* ...
* Load in DFP Loading Code, the important thing here is that we
* are adding in tht `slotRenderEnded` Event Listener. When triggered,
* it will fire the slotRenderedEventMethod function listed below.
*/
googletag
.pubads()
.addEventListener('slotRenderEnded', slotRenderedEventMethod)
@CodeVachon
CodeVachon / .bash_profile
Last active Aug 31, 2015
My .bash_profile file
View .bash_profile
# Git Auto Complete
# install these in home (~) directory.
# https://github.com/git/git/blob/8976500cbbb13270398d3b3e07a17b8cc7bff43f/contrib/completion/git-completion.bash
# https://github.com/git/git/blob/8976500cbbb13270398d3b3e07a17b8cc7bff43f/contrib/completion/git-prompt.sh
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
if [ -f ~/.git-prompt.sh ]; then
source ~/.git-prompt.sh
@CodeVachon
CodeVachon / get_document.js
Last active Aug 29, 2015
When To Use a Promise
View get_document.js
// ASSUME JQUERY
var document_cache = [];
function getDocument(documentId) {
var _deferred = new $.Deferred()
_document_sent = false; // Note that this could be removed by using `_deferred.state()`
;
// Iterate over the document_cache array
@CodeVachon
CodeVachon / app.js
Created Aug 14, 2015
Sifting Through Promise Docs Ex
View app.js
function myCallingMethod() {
var _deferred = new $.Deferred()
var _myValue = 123;
setTimeout(function() {
_deferred.resolve(_myValue);
}, 500);
return _deferred.promise();
}
var myPromise = myCallingMethod();