This file contains 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
# Adding context for req/res cycle for Express.js. | |
# With context it would be possible to write more terse code: | |
# | |
# app.use -> | |
# @user = {name: 'Anonymous'} | |
# @next() | |
# | |
# app.get '/', -> | |
# @res.end "Hello, #{@user.name}" | |
# |
This file contains 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 dom = $("#form"); //empty dom | |
dom.quickform({ | |
title:"Test Edit", | |
fields:{ | |
user:"text", | |
email:"text", | |
comment:"textarea" | |
}, | |
save:function(object){ |
This file contains 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
/** Example: | |
<script src="bootstrap.quickform.js"></script> | |
<form id="test" class="form hide"> | |
<legend>Hello</legend> | |
<label for="">Something</label><input type="text" value="hello"> | |
</form> | |
<script> | |
var dom = $("#test"); | |
var config = { | |
title:"Hello World", |
This file contains 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
// My App | |
window.App = $.extend(true,window.App||{},{ | |
Views:{},Collections:{},Models:{} | |
},Backbone.Events); | |
/* PHP Port for accessing Data example | |
App._GET = <?=count($_GET)?json_encode($_GET):"{}"?>; | |
App._DATA = <?=count($data)?json_encode($data):"{}"?>; | |
*/ |
This file contains 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
###== Basic server based on coffee-script & express == | |
# run by forever: | |
sudo forever -w -c coffee server.coffee | |
### | |
_ = require("underscore")._ | |
express = require "express" | |
app = express() | |
console.log "\n--- BEGIN --- @ " + new Date() | |
### Config Part ### |
This file contains 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
// Bookmarklet Example | |
// javascript:(function(){ })(); | |
// load script For bookmarklet | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = "helper.js"; | |
head.appendChild(script); |
This file contains 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
.modColor(@hue,@sat,@light:85%){ | |
@color:hsl(@hue,@sat,@light); | |
border-color:@color; | |
strong,h3,h4,h5,h6 { color:desaturate(darken(@color,15%),10%) } | |
.mod-header { | |
background-color:lighten(@color,0.8*(100%-@light)); | |
border-color: lighten(@color,0.7*(100%-@light)); } | |
.mod-footer { |
This file contains 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
/*! Copyright | |
* (c) 2010, Brandon Aaron (http://brandonaaron.net) | |
* (c) 2012 - 2013, Alexander Zaytsev (http://hazzik.ru/en) | |
* Dual licensed under the MIT (MIT_LICENSE.txt) | |
* and GPL Version 2 (GPL_LICENSE.txt) licenses. | |
* | |
* Version: 1.3.4 | |
* Requires jQuery 1.3+ | |
* Docs: http://docs.jquery.com/Plugins/livequery | |
*/ |
This file contains 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
/** | |
* dynamicly add css contents for IE6+ and modern browsers. | |
* source: http://stackoverflow.com/questions/3922139/add-css-to-head-with-javascript | |
* example: addcss("strong { color: red }"); | |
*/ | |
function addcss(css){ | |
var head = document.getElementsByTagName('head')[0]; | |
var s = document.createElement('style'); | |
s.setAttribute('type', 'text/css'); | |
if (s.styleSheet) { // IE |
This file contains 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
/** | |
* QueryModel based on jQuery,momentjs,backbonejs. | |
* usage: | |
* // _GET = {"pre_key":"value","pre_key2":"value2"}; | |
* var query = new QueryModel(_GET,{prefix:"pre"}); | |
* // console.log(query.toJSON()); | |
* // Object {key: "value", key2: "value2"} | |
* // console.log(query.getUrl()) | |
* // "http://localhost/path/?key=value&key2=value2" | |
*/ |
OlderNewer