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
.markdown-body { overflow: hidden; font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif; font-size: 16px; line-height: 1.6; word-wrap: break-word } | |
.markdown-body>*:first-child { margin-top: 0 !important } | |
.markdown-body>*:last-child { margin-bottom: 0 !important } | |
.markdown-body .absent { color: #c00 } | |
.markdown-body .anchor { position: absolute; top: 0; bottom: 0; left: 0; display: block; padding-right: 6px; padding-left: 30px; margin-left: -30px } | |
.markdown-body .anchor:focus { outline: none } | |
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { position: relative; margin-top: 1em; margin-bottom: 16px; font-weight: bold; line-height: 1.4 } | |
.markdown-body h1 .octicon-link, .markdown-body h2 .octicon-link, .markdown-body h3 .octicon-link, .markdown-body h4 .octicon-link, .markdown-body h5 .octicon-link, .markdown-body h6 .octicon-link { display: none; color: #000; vertical-align: middle } | |
.markdown-body h1:hover .ancho |
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
// based on requirejs and backbone style views currently | |
$.fn.directive = (method,options)-> | |
$dom = $(this) | |
if not method #init | |
viewName = $dom.attr("directive") | |
if viewName then require ["directive/#{viewName}"], (View)-> | |
view = new View(el:$dom[0]) | |
isRender = $dom.attr("render") | |
if isRender=="" or isRender | |
view.render() |
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
timer = do -> | |
start = (new Date).getTime() | |
(log...)-> | |
time = ((new Date).getTime()-start)/1000 | |
console.warn "timer: ",time, log... |
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
### | |
Gruntfile example for requirejs optimizing and less files watching | |
### | |
module.exports = (grunt) -> | |
out = (path)-> "../public-dist/#{path}" | |
grunt.initConfig | |
requirejs: | |
options: | |
mainConfigFile: "../public/require-config.js" | |
baseUrl: "../public" |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ index.html?/$1 [L] | |
</IfModule> | |
<IfModule !mod_rewrite.c> | |
ErrorDocument 404 /index.php | |
</IfModule> |
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
View = do -> | |
extend = (obj,objs...)-> | |
while o = objs.shift() | |
obj[k] = o[k] for k of o | |
return obj | |
class BaseView | |
constructor:(o={})-> | |
@el = o.el | |
@$el = $(o.el) | |
@initialize?() |
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
if typeof define == 'function' && define.amd then define(["jquery"],factory) | |
else factory(jQuery) | |
factory = ($)-> | |
## Do Something |
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 BaseView | |
constructor:(options)-> | |
@options = options | |
@el = options.el | |
@$el = $(@el) | |
@initialize?(options) |
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
# usage: app.use "/[collectionName]", require("./routes/[collectionName]") | |
express = require('express') | |
class ModelRestfulRouter | |
findOne:(req,res)-> | |
@model.findById req.params.id,(err,data)-> | |
unless err then res.json(data) | |
find:(req,res)-> | |
query = req?.query or {} |