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 express = require('express'); | |
var router = express.Router(); | |
/** | |
* Get events from the REST webservice | |
* [GET] url: https://mydomain.com/event/params?eventType=festival,gallery,show | |
*/ | |
router.get('/event', function(req, res) { | |
var query = {}; //query for MongoDB | |
var arr,subq; |
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 array = string.split(','); | |
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
items.save({ | |
name: "example", | |
created_at: ISODate("2010-04-30T00:00:00.000Z") | |
}) | |
items.find({ | |
created_at: { | |
$gte: ISODate("2010-04-29T00:00:00.000Z"), | |
$lt: ISODate("2010-05-01T00:00:00.000Z") | |
} | |
}) |
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
function serializeToJSON(form) { | |
var jsonData = {}; | |
console.log('......serializeToJSON'); | |
var formData = form.serializeArray(); | |
$.each(formData, function() { | |
if (jsonData[this.name]) { | |
if (!jsonData[this.name].push) { | |
jsonData[this.name] = [jsonData[this.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
router.get('/search', function(req, res) { | |
var query = {}; | |
var arr; | |
var subq; | |
var styles; | |
//Styles filter | |
if (req.query.styles) { | |
styles = req.query.styles; |
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
router.get('/:id', function(req, res) { | |
var eventID = req.params.id; | |
}); | |
//http://myurl.com/search?param1=value1¶m2=value2 | |
router.get('/search', function(req, res) { | |
var param1,param2; | |
if (req.query.param1) { | |
param1 = req.query.param1; |
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
.wrap { | |
white-space: pre-wrap; /* CSS3 */ | |
white-space: -moz-pre-wrap; /* Firefox */ | |
white-space: -pre-wrap; /* Opera <7 */ | |
white-space: -o-pre-wrap; /* Opera 7 */ | |
word-wrap: break-word; /* 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
var someAsyncFunction = function(callback) { | |
setTimeout(function() { | |
var template = '<h1>{{message}}</h1>'; | |
callback(template); | |
}, 1000); | |
}; | |
$(document).ready(function() { | |
someAsyncFunction(function(template) { | |
var compiledTemplate = Handlebars.compile(template); |
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
li:before { | |
content: ""; | |
display: inline-block; | |
height: 1rem; // or px or em or whatever | |
width: .5rem; // or whatever space you want | |
} |
OlderNewer