Let's say you want to host domains first.com
and second.com
.
Create folders for their files:
[ | |
{name: 'Afghanistan', code: 'AF'}, | |
{name: 'Åland Islands', code: 'AX'}, | |
{name: 'Albania', code: 'AL'}, | |
{name: 'Algeria', code: 'DZ'}, | |
{name: 'American Samoa', code: 'AS'}, | |
{name: 'AndorrA', code: 'AD'}, | |
{name: 'Angola', code: 'AO'}, | |
{name: 'Anguilla', code: 'AI'}, | |
{name: 'Antarctica', code: 'AQ'}, |
# REF: http://www.quora.com/How-do-I-create-and-update-embedded-documents-with-MongoEngine | |
class Comment(EmbeddedDocument): | |
content = StringField() | |
name = StringField(max_length=120) | |
class Post(Document): | |
title = StringField(max_length=120, required=True) | |
author = StringField(required=True) |
function isOnScreen(elem) { | |
// if the element doesn't exist, abort | |
if( elem.length == 0 ) { | |
return; | |
} | |
var $window = jQuery(window) | |
var viewport_top = $window.scrollTop() | |
var viewport_height = $window.height() | |
var viewport_bottom = viewport_top + viewport_height | |
var $elem = jQuery(elem) |
[ | |
"Afghan", | |
"Albanian", | |
"Algerian", | |
"American", | |
"Andorran", | |
"Angolan", | |
"Antiguans", | |
"Argentinean", | |
"Armenian", |
http://apassant.net/2012/01/16/timeout-for-html5-localstorage/ | |
var hours = 24; // Reset when storage is more than 24hours | |
var now = new Date().getTime(); | |
var setupTime = localStorage.getItem('setupTime'); | |
if (setupTime == null) { | |
localStorage.setItem('setupTime', now) | |
} else { | |
if(now-setupTime > hours*60*60*1000) { | |
localStorage.clear() |
/** | |
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
* It was requested to be introduced at as part of the jsonwebtoken library, | |
* since we feel it does not add too much value but it will add code to mantain | |
* we won't include it. | |
* | |
* I create this gist just to help those who want to auto-refresh JWTs. | |
*/ | |
const jwt = require('jsonwebtoken'); |
export default [ | |
{ name: 'Afghanistan', code: 'AF', name_fa: 'افغانستان' }, | |
{ name: 'land Islands', code: 'AX', name_fa: 'جزایر الند' }, | |
{ name: 'Albania', code: 'AL', name_fa: 'آلبانی' }, | |
{ name: 'Algeria', code: 'DZ', name_fa: 'الجزایر' }, | |
{ name: 'American Samoa', code: 'AS', name_fa: 'ساموآی آمریکا' }, | |
{ name: 'AndorrA', code: 'AD', name_fa: 'آندورا' }, | |
{ name: 'Angola', code: 'AO', name_fa: 'آنگولا' }, | |
{ name: 'Anguilla', code: 'AI', name_fa: 'آنگویلا' }, | |
{ name: 'Antigua and Barbuda', code: 'AG', name_fa: 'آنتیگوآ و باربودا' }, |
from mongoengine import connect, Document, EmbeddedDocument, \ | |
ReferenceField, EmbeddedDocumentListField, StringField, ObjectIdField | |
connect() # Connect to `test` database by default | |
###### | |
# Option1: Using 2 different collections for users and tickets | |
###### | |
class User(Document): | |
name = StringField() |