form validation test
A Pen by Kristoffer Snabb on CodePen.
form validation test
A Pen by Kristoffer Snabb on CodePen.
var http = require("http"); | |
var server = http.createServer(function(req, res) { | |
res.end("hello world"); | |
}); | |
server.listen("8090"); |
package main | |
import "net/http" | |
func handler(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("hello world")) | |
} | |
func main() { | |
http.HandleFunc("/", handler) |
Drag and drop an image to the canvas which then performs simple rotation on the image.
A Pen by Kristoffer Snabb on CodePen.
Routes Indiana jones style, with canvas.
A Pen by Kristoffer Snabb on CodePen.
// Calculate distance between two given points on a plane | |
(function(root) { | |
// a and b are given as arrays of length 2 | |
var distance = function(a, b) { | |
return Math.sqrt(Math.pow(b[0] - a[0], 2) + Math.pow(b[1] - a[1], 2)); | |
}; | |
root.distance = distance; |
// calculate a new point according to start point, destination, speed and time. | |
(function(root) { | |
// start and destination are points given as arrays of length 2 | |
// speed is in m/s | |
// time is in seconds | |
var currentPosition = function(start, destination, speed, time) { | |
var distanceTravelled = speed * time; | |
// calulate the diff x and diff y to be travelled |
// calculate the speed according to two points and two times | |
(function(root) { | |
// speed is returned in m / s | |
// points given as arrays of length 2 and coordinates in meters | |
// times are given in milliseconds | |
var speed = function(startPoint, endPoint, startTime, endTime) { | |
var distance = this.distance(startPoint, endPoint); | |
var timeDiff = (endTime - startTime) / 1000; | |
return distance / timeDiff; |
var gulp = require('gulp'); | |
var jade = require('gulp-jade'); | |
var browserify = require('browserify'); | |
var uglify = require('gulp-uglify'); | |
var transform = require('vinyl-transform'); | |
var stylus = require('gulp-stylus'); | |
var nib = require('nib'); | |
// templates |