Skip to content

Instantly share code, notes, and snippets.

View donnut's full-sized avatar

Erwin donnut

  • Amsterdam, The Netherlands
View GitHub Profile
@donnut
donnut / .vimrc
Created February 24, 2012 19:17
Vim script to convert jasmine test file to qunit
"add this to .vimrc
source ~/dev/jasmine2qUnit/jasmine2qUnit.vim
nmap ;q :call ConvertJasmineTest2qUnit()<CR>
@donnut
donnut / nl.po
Created February 24, 2012 20:37
Dutch translation of VIM
# Dutch Translation for Vim vim:set foldmethod=marker:
# Do ":help uganda" in Vim to read copying and usage conditions.
# Do ":help credits" in Vim to see a list of people who contributed.
# Previous-Translator(s):
# highlight: oplichten
# Erwin Poeze <[email protected]>, 2011, 2012.
msgid ""
msgstr ""
"Project-Id-Version: vim 7.3\n"
"Report-Msgid-Bugs-To: \n"
@donnut
donnut / mutt-1.5.20.nl.po
Created June 20, 2012 06:19
Dutch translation of mutt
# $Id$
msgid ""
msgstr ""
"Project-Id-Version: Mutt 1.5.20\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-06-14 11:53-0700\n"
"PO-Revision-Date: 2012-06-20 12:59+0200\n"
"Last-Translator: Erwin Poeze <[email protected]>\n"
"Language-Team: René Clerc <[email protected]>\n"
"MIME-Version: 1.0\n"
@donnut
donnut / account.js
Created September 25, 2012 08:33
comparePassword issue
var u = require('./user')
, mongoose = require('mongoose')
, db = mongoose.createConnection('localhost', 'mydb');
var User = u.User;
var user = new User({username: 'test4', email:'[email protected]', password: 'secret'});
user.save(function(err) {
User.find({username: 'test4' }, function(err, user){
if ( err ) console.log(err)
user.comparePassword('hidden', function(err, isMatch) {
@donnut
donnut / A.js
Created September 25, 2012 10:56
mongoose recursive schema definition that includes model (fails)
define([
'mongoose'
, './Cm'
], function(
mongoose,
Cm
) {
var A = new mongoose.Schema({
name: String
@donnut
donnut / A.js
Created September 25, 2012 11:05
mongoose recursive schema definition that includes a model (successful)
define([
'mongoose'
, './Bm'
], function(
mongoose,
Bm
) {
var A = new mongoose.Schema({
name: String
@donnut
donnut / gist:3781861
Created September 25, 2012 13:30
Example of limiting the number of populated documents with where() and elemMatch
var requirejs = require('requirejs')
, mongoose = require('mongoose');
requirejs.config({
baseUrl: __dirname
, nodeRequire: require
});
requirejs([], function() {
@donnut
donnut / index.html
Created October 23, 2012 11:41
backbone-association / specifying collection type
<!doctype html>
<html lang="en">
<head>
<title>QUnit Tests</title>
<meta charset='utf-8' />
<link rel="stylesheet" href="./lib/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="./lib/jquery.js"></script>
<script type="text/javascript" src="./lib/underscore.js"></script>
<script type="text/javascript" src="./lib/backbone.js"></script>
<script type="text/javascript" src="./lib/backbone-associations.js"></script>
<!doctype html>
<html lang="en">
<head>
<title>QUnit Tests</title>
<meta charset='utf-8' />
<link rel="stylesheet" href="./lib/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="./lib/json2.js"></script>
<script type="text/javascript" src="./lib/jquery.js"></script>
<script type="text/javascript" src="./lib/jquery.mockjax.js"></script>
<script type="text/javascript" src="./lib/underscore.js"></script>
@donnut
donnut / main.js
Created November 1, 2012 12:28
populating a referenced mongoose model, three levels deep
var mongoose = require('mongoose'),
assert = require('assert')
mongoose.connect('localhost/mydb');
var Schema = mongoose.Schema;
var ContainerSchema = new Schema({
name: String,
})