Skip to content

Instantly share code, notes, and snippets.

@jbeuckm
jbeuckm / simple_csv_filter.js
Created November 4, 2016 19:55
A quick nodejs filter to process a CSV file.
var fs = require('fs');
var csv = require('csv');
var md4 = require('js-md4');
fs.createReadStream(__dirname+'/input.csv')
.pipe(csv.parse({columns: true}))
.pipe(csv.transform(function(record){
record.my_field = md4(record.my_field);
@saadtazi
saadtazi / app.js
Created July 19, 2016 11:52
passport multiple strategies
const express = require('express');
const cons = require('consolidate');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const passport = require('passport');
const FacebookStrategy = require('passport-facebook').Strategy;
const LocalStrategy = require('passport-local').Strategy;
const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn;
@willrstern
willrstern / node-ubuntu-upstart-service.md
Last active August 17, 2023 10:15
Run Node.js App as Ubuntu Upstart Service

###The Issue With Forever Forever is great for running node services, with a minor setback: the word "forever" doesn't apply to system reboots.

###The solution, run node apps as a system service logged in as root

vim /etc/init/node-app.conf

Contents for node-app.conf

@twairball
twairball / gist:6882041
Last active December 24, 2015 23:39
core data setup for xcode5 unit testing (iOS)
@interface StoreViewControllerTest : XCTestCase
@end
@implementation StoreViewControllerTest {
NSManagedObjectContext* _moc;
StoreViewController* _storeController;
}
- (void)setUp {
@tonylukasavage
tonylukasavage / README.md
Created April 10, 2013 13:58
My new "license" for my OSS projects

license

Do whatever you want with this code. I offer it without expectation or warranty. No need to credit me in your project or source code. A digital high five would be nice, but is not required.

(function($) {
function parseImagesFromCSS(doc) {
var i, j,
rule,
image,
pattern = /url\((.*)\)/,
properties = ['background-image', '-webkit-border-image'],
images = {};
if (doc.styleSheets) {
@jupiterjs
jupiterjs / $.Controller.md
Created May 27, 2011 21:21
$.Controller for Alex MacCaw's Book

TODOS:

  • show .models() method and hookup

$.Controller - jQuery plugin factory

JavaScriptMVC's controllers are many things. They are a jQuery plugin factory. They can be used as a traditional view, making pagination widgets and grid controls. Or, they can be used as a traditional controller, initializing and controllers and hooking them up to models. Mostly, controller's are a really great way of organizing your application's code.

Controllers provide a number of handy features such as:

@jupiterjs
jupiterjs / JavaScriptMVC.md
Created May 24, 2011 16:58 — forked from moschel/JavaScriptMVC.md
JavaScriptMVC Overview

The following is a VERY rough draft of an article I am working on for Alex MacCaw's @maccman's Book. It is very rough, but even now a worthwhile read. Suggestions / comments are very welcome! Please help me :-)

Introduction

JavaScriptMVC (JMVC) is an open-source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) front-end development framework, packaging utilities for testing, dependency management, documentation, and a host of useful jQuery plugins.

Yet every part of JavaScriptMVC can be used without every other part, making the library lightweight. Its Class, Model, View, and Controller combined are only 7k minified and compressed, yet even they can be used independently. JavaScriptMVC's independence lets you start small and scale to meet the challenges of the most complex applications on the web.

This chapter covers only JavaScriptMVC's $.Class, $.Model, $.View, and $.Controller. The following describes each component: