Skip to content

Instantly share code, notes, and snippets.

View gijs's full-sized avatar

Gijs Nijholt gijs

View GitHub Profile
// jslint configuration
/*jslint browser: true */
/*global $, window */
var console = console || {
log:function() {},
warn: function() {},
dir: function() {},
error: function() {}
};
@gijs
gijs / watchout.cfg
Created October 12, 2011 08:56
Projectwatch-buildout for SCSS and CoffeeScript compilation
# Usage::
#
# bin/buildout -c watchout.cfg
# source bin/activate
# projectwatch src/my.project
# deactivate
#
# See also: https://github.com/epeli/Projectwatch
[buildout]
@gijs
gijs / 04_jshint.rake
Created October 25, 2011 08:01 — forked from jamesarosen/04_jshint.rake
Javascript Loves CI: Jenkins + Jasmine + PhantomJS + JSHint
namespace :jshint do
task :require do
sh "which jshint" do |ok, res|
fail 'Cannot find jshint on $PATH' unless ok
end
end
task :check => 'jshint:require' do
project_root = File.expand_path('../../', File.dirname(__FILE__))
config_file = File.join(project_root, 'config', 'jshint.json')
@gijs
gijs / Rakefile
Created December 20, 2011 22:35 — forked from erochest/Rakefile
Vagrant/Rake config files for setting up a GeoServer instance.
require 'etc'
require 'fileutils'
require 'vagrant'
task :default => :usage
task :usage do
puts "You forgot to tell the computer what to do; try one of these commands:"
@gijs
gijs / gauge.js
Created February 25, 2012 20:26 — forked from tomerd/gauge.js
google style gauges using javascript d3.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // some internal d3 functions do not "like" the "this" keyword, hence setting a local variable
this.configure = function(configuration)
{
this.config = configuration;
@gijs
gijs / example-user.js
Created May 4, 2012 10:53 — forked from nijikokun/example-user.js
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_multiTenant');
/**
* User schema.
*/
var UserSchema = new mongoose.Schema({
name: String
, prefix: { type: String, required: true }
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.jsuereth#sbt-site-plugin;0.4.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.jsuereth:sbt-site-plugin:0.4.0 (sbtVersion=0.11.2, scalaVersion=2.9.1)
[warn]
[error] {git://github.com/jsuereth/xsbt-ghpages-plugin.git}sbt-ghpages-plugin/*:update: sbt.ResolveException: unresolved dependency: com.jsuereth#sbt-site-plugin;0.4.0: not found
@gijs
gijs / app.js
Created June 3, 2012 13:30
Error: Schema hasn't been registered for model "tenant1234Workspaces".
require("v8-profiler")
var express = require('express'),
passport = require('passport'),
path = require('path'),
http = require('http'),
url = require('url'),
DropboxClient = require('dropbox').DropboxClient,
MongoStore = require('connect-mongo')(express),
mongoose = require('mongoose'),
Schema = mongoose.Schema,
@gijs
gijs / TileLayer.TileJSON.js
Created June 12, 2012 19:20 — forked from DGuidi/TileLayer.TileJSON.js
Leaflet TileCanvas
L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({
options: {
debug: false
},
tileSize: 256,
initialize: function (options) {
L.Util.setOptions(this, options);