This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = | |
| class Pie | |
| pos: 0 | |
| colors: ['yellow', 'black'] | |
| constructor: (@canvas, {@yes, @no}) -> | |
| @data = [@yes, @no] | |
| @context = canvas.getContext("2d") | |
| #uses underscore for reduce but just swap with vanilla js if needed | |
| @total = _.reduce @data, (memo, num) -> memo + num | |
| @draw() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - var background = function(url) { | |
| - return "background-size: cover; background-image: url('" + url + "'); -ms-filter: \"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod='scale')\";"; | |
| - } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = (file, cb) -> | |
| valid = (/image\/(gif|jpg|jpeg|tiff|png)$/i).test file.type | |
| return false if not valid | |
| reader = new FileReader() | |
| reader.onload = (e) -> | |
| cb(e.target.result) | |
| reader.readAsDataURL(file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| psst = require 'psst' | |
| module.exports = require 'space-pen' | |
| module.exports.EventView = | |
| class EventView extends module.exports.View | |
| subscriptions: null | |
| initialize: -> | |
| return unless @subscriptions | |
| for subscription, method of @subscriptions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| function loadScript(a,b){ | |
| var c=document.createElement('script'); | |
| c.type='text/javascript';c.src=a; | |
| var d=document.getElementsByTagName('head')[0],done=false; | |
| c.onload=c.onreadystatechange=function(){ | |
| if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){ | |
| done=true; | |
| b() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| debounce = (timeout, fn, timer = null) -> -> | |
| clearTimeout timer | |
| timer = setTimeout fn, timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| img(src, width, height) | |
| image(src) | |
| background-size: contain | |
| background-repeat: no-repeat | |
| background-position: 50% | |
| max-width: width | |
| width: 100% | |
| margin-left: auto | |
| margin-right: auto |
OlderNewer