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
| model 'User' | |
| name: {type: String, index: true} | |
| email: {type: String, index: true, unique: true} | |
| password: String | |
| model 'Post' | |
| title: String | |
| creator: {type: User.ObjectId, required: true} | |
| createdOn: {type: Date, required: true} | |
| mostRecentEditor: {type: User.ObjectId, required: true} |
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 tubes = require('tubes'); | |
| var model = new tubes.model.Model({ | |
| name: 'Bob Dobbs', | |
| age: 34, | |
| favoriteColor: 'red' | |
| }); | |
| model.on('updated', function (data) { | |
| tubes.emit('data updated', model.fields); |
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 () { | |
| return ['Jan.', 'Feb.', 'Mar.', | |
| 'Apr.', 'May', 'Jun.', | |
| 'Jul.', 'Aug.', 'Sep.', | |
| 'Oct.', 'Nov.', 'Dec.'][this.getMonth()] + " " + | |
| (function (d) { | |
| var s = d.toString(), l = s[s.length-1]; | |
| return s+(['st','nd','rd'][l-1] || 'th'); | |
| })(this.getDate()) + ", " + | |
| this.getFullYear() + " " + |
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
| window.onscroll = function () { | |
| if (!docked && (menu.offsetTop - scrollTop() < 0)) { | |
| menu.style.top = 0; | |
| menu.style.position = 'fixed'; | |
| menu.className = 'docked'; | |
| docked = true; | |
| } else if (docked && scrollTop() <= init) { | |
| menu.style.position = 'absolute'; | |
| menu.style.top = init + 'px'; | |
| menu.className = menu.className.replace('docked', ''); |
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
| from django import template | |
| register = template.Library() | |
| @register.filter | |
| def truncatesmart(value, limit=80): | |
| """ | |
| Truncates a string after a given number of chars keeping whole words. | |
| Usage: |
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
| <html> | |
| <head> | |
| <title></title> | |
| <script src="jquery.js"></script> | |
| <script type="text/jqtpl" id="item"> | |
| <h1>{{ title }}</h1> | |
| <p>Name: {{ name }}</p> | |
| </script> | |
| <script> | |
| var counter = 0; |
NewerOlder