Skip to content

Instantly share code, notes, and snippets.

View itzaks's full-sized avatar

Isak ✏ ⇝ itzaks

View GitHub Profile
VALIDATIONS =
mobile_number: (val) -> val.match /[06]{1}[7]{1}[0-9]{8}/
zipcode: (val) -> val.match /^(s-|S-){0,1}[0-9]{3}\s?[0-9]{2}$/
email: (val) -> val.match /^\S+@\S+\.\S+$/
personnummer: (val) ->
console.log (val.match /[1-2][0|9][0-9]{2}[0-1][0-9][0-3][0-9][0-9]{4}/), val.length is 12
(val.match /[1-2][0|9][0-9]{2}[0-1][0-9][0-3][0-9][0-9]{4}/) and val.length is 12
module.exports = ($form, validation) ->
@itzaks
itzaks / server.coffee
Last active December 24, 2015 08:29
Brunch server file.
class Server
mongoose: require 'mongoose'
express: require 'express'
path = require 'path'
constructor: ->
@app = @express()
@app.use @express.static(path.resolve "public")
@app.use @express.bodyParser()
@itzaks
itzaks / embedder.coffee
Created March 31, 2013 13:13
Helper for embedding an iframe right after this script node. Also includes some css and javascript insert methods. Can limit the iframe to specific size.
class Embed
embedded: false
width: 250
height: 250
name: "something"
baseURL: "//s3-eu-west-1.amazonaws.com/some-bucket"
constructor: (@script) ->
@width = @script.width if @script.width
@height = @script.height if @script.height