Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Busy Coding...

Christopher Vachon CodeVachon

:octocat:
Busy Coding...
View GitHub Profile
@CodeVachon
CodeVachon / Sublime Project
Created Aug 1, 2014
A Sublime Profile File Template
View Sublime Project
{
"folders":
[
{
"follow_symlinks": true,
"path": "/path/to/working/dir",
"folder_exclude_patterns": [".*","node_modules"],
"file_exclude_patterns": [".DS_Store","Thumbs.db"]
}
],
@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 / gist:db629606a4ad31af212b
Created Mar 4, 2015
AngularJS $resource .get modify data
View gist:db629606a4ad31af212b
//
// Note that Articles is a $resource pointing to a express RESTful API
//
angular.module('App')
.controller('ArticlesEditController', ["$scope", "$routeParams", "$location", "Articles",
function($scope, $routeParams, $location, Articles) {
$scope.article = Articles.get({id: $routeParams.id},function(_data) {
_data.publish_date = new Date(_data.publish_date);
});
@CodeVachon
CodeVachon / app.js
Last active Aug 29, 2015
Showdown Gist
View app.js
//
// Main Angular Application
//
angular.module('MyApp', ['markdown'])
.config(function(markdownProvider) {
markdownProvider.config({
extensions: ['table','gist']
});
});
@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 / app.js
Created Jun 9, 2015
Activity Board Step 1
View app.js
var
express = require('express'),
app = express(),
server = require('http').Server(app),
io = require('socket.io')(server)
;
app.use( express.static(__dirname + '/public') );
server.listen(3030, function(){
@CodeVachon
CodeVachon / app.js
Created Jun 9, 2015
Activity Board Step 2
View app.js
// ...
io.on('connection', function(socket){
console.log('a user connected');
socket.on('disconnect', function(){
console.log('user disconnected');
});
socket.on('add activity', function(activityName){
@CodeVachon
CodeVachon / app.js
Last active Aug 29, 2015
Promise Module
View app.js
var express = require('express'),
app = express(),
port = process.env.PORT || 3030,
myModule = require('./myModule')
;
app.get('/', function(request, response, next) {
myModule("Hello World").done(function(result) {
response.json(result);
}).fail(function(error) {
@CodeVachon
CodeVachon / app.js
Last active Aug 29, 2015
Callback Module
View app.js
var express = require('express'),
app = express(),
port = process.env.PORT || 3030,
myModule = require('./myModule')
;
app.use(express.static(__dirname + '/public'));
app.get('/', function(request, response, next) {
myModule("Hello World", function(error, result) {
@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