Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
| .mouse, #preview{ | |
| position: absolute; | |
| background-repeat: no-repeat; | |
| height: 22px; | |
| min-width: 15px; | |
| z-index: 100; | |
| } | |
| .mouse{ | |
| background-image: url('../images/cursor.png'); |
Some exercises from the Falsy Values workshops.
The good parts:
| # Usage:: | |
| # | |
| # bin/buildout -c watchout.cfg | |
| # source bin/activate | |
| # projectwatch src/my.project | |
| # deactivate | |
| # | |
| # See also: https://github.com/epeli/Projectwatch | |
| [buildout] |
| 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') |
| 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:" |
| 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; |
| 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 } |
| L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({ | |
| options: { | |
| debug: false | |
| }, | |
| tileSize: 256, | |
| initialize: function (options) { | |
| L.Util.setOptions(this, options); |
| L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({ | |
| options: { | |
| debug: false | |
| }, | |
| tileSize: 256, | |
| initialize: function (options) { | |
| L.Util.setOptions(this, options); |