Skip to content

Instantly share code, notes, and snippets.

View metasansana's full-sized avatar
🕺
Wine on a buffer.

Lasana Murray metasansana

🕺
Wine on a buffer.
View GitHub Profile
@metasansana
metasansana / nunjucks
Last active August 29, 2015 14:03
KeystoneJS with nunjucks.
//Of course you may want to do more configuration than this.
var app = express();
var env = nunjucks.configure('/views', {
autoescape: true,
express: app,
tags: {
variableStart: '<$',
variableEnd: '$>'
}
//Here is a simple example. Pretend we are using express.
var app = express();
var config;
var db = new ConfigServerThing();
//This part is useless because the main loop exits before we call app.listen()
db.find(function(err, config) {
if(err) throw err;
@metasansana
metasansana / gist:1d06c9adf5c6697c0f98
Created July 20, 2014 02:12
Vendorlizer Sample .env file
CLOUDINARY_URL=cloudinary://null
MANDRILL_API_KEY=null
COOKIE_SECRET="Cat Keyboard"
MONGO_URI="mongodb://localhost/myexample"
DOMAIN="myexample"
BRAND="Vendorlizer"
@metasansana
metasansana / gist:107132f1920cb5a1d7cc
Created August 4, 2014 00:55
Make directories based on the files in a folder (excluding the extensions).
for i in $(ls | cut -d "." --complement -f2- ); do mkdir $i; done
@metasansana
metasansana / broken by promises
Last active August 29, 2015 14:10
Broken by promises
/**
I've been using promises a lot lately after my first dance in callback hell.
I have not read (but did skim) any of the specs nor do I intend too. I also find the bedtime stories about
promises cute but far to wordy when I'm in a hurry.
So I decided to type up this for future reference, when next time I chain some promises together and am completly confused as
to why they don't work the way I expect.
Think of promises like an asynchronous try, catch, finally
@metasansana
metasansana / testing-your-keystone
Last active August 29, 2015 14:12
Running a multiple functional tests for a keystone app.
var q = require('q');
require('must');
var keystone;
var sockets = [];
beforeEach(function(done) {
require.cache = {};
keystone = require('keystone');
@metasansana
metasansana / testing-your-http-server
Created December 31, 2014 15:21
Running a multiple functional tests for a http.Server app.
var http = require('http');
var q = require('q');
require('must');
var server;
var sockets = [];
beforeEach(function(done) {
server = http.createServer();
server.listen(8000, done);
module.exports = {
name: 'patientForm',
controls: [{
type: 'text',
name: 'name[first]',
label: {
id: 'name[first]',
name: 'Name'
},
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Contact</legend>
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" placeholder="placeholder" class="form-control input-md" type="text">
@metasansana
metasansana / gist:9e6c3339b9679575c768
Last active August 29, 2015 14:14
Generic Form as directive.
var app = angular.module('myApp', []);
app.directive('contactGeneric', function() {
return {
restrict: 'E',
templateUrl: 'contactGeneric.html'
};
});