Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| global.config = require('./lib/config').load("config/app.json"); | |
| var cluster = require('cluster'); | |
| var fs = require('fs'); | |
| var app = require('./app'); | |
| // Logging | |
| var log = require('./lib/winston'); | |
| global.log = log; | |
| // Write out pidfile |
| First, create a new local git repo: | |
| $ mkdir my-project && cd my-project | |
| $ git init | |
| Initialized empty Git repository in ~/projects/my-project/.git/ | |
| $ echo 'Hello, world!' > index.html | |
| $ git add index.html | |
| $ git commit -q -m "Initial commit" | |
| Then, on the remote server create a new directory for the new repo we just created: |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| var fs = require("fs") | |
| var ssl_options = { | |
| key: fs.readFileSync('privatekey.pem'), | |
| cert: fs.readFileSync('certificate.pem') | |
| }; | |
| var port = process.env.PORT || 3000; | |
| var express = require('express'); | |
| var ejs = require('ejs'); | |
| var passport = require('passport') |
| // Named constants with unique integer values | |
| var C = {}; | |
| // Tokenizer States | |
| var START = C.START = 0x11; | |
| var TRUE1 = C.TRUE1 = 0x21; | |
| var TRUE2 = C.TRUE2 = 0x22; | |
| var TRUE3 = C.TRUE3 = 0x23; | |
| var FALSE1 = C.FALSE1 = 0x31; | |
| var FALSE2 = C.FALSE2 = 0x32; | |
| var FALSE3 = C.FALSE3 = 0x33; |
| // overriding sync to use local storage when possible | |
| sync : function(method, model, options){ | |
| var key, now, timestamp, refresh; | |
| if(method === 'read' && this.constants.isStoredInLocalStorage) { | |
| // only override sync if it is a fetch('read') request | |
| key = this.getKey(); | |
| if(key) { | |
| now = new Date().getTime(); | |
| timestamp = $storage.get(key + ":timestamp"); | |
| refresh = options.forceRefresh; |
Here's how this works:
git_hooks/ directory in your project, with these two files (plus other hooks if you want, written in a similar style)."npm" to your devDependencies in package.json, so that the pre-commit hook can do its magic.test and lint scripts to your package.json, e.g. "scripts": {
"test": "mocha",
"lint": "jshint ./lib --show-non-errors"| <script type="text/javascript"> | |
| var _gaq = _gaq || []; | |
| _gaq.push(['_setAccount', 'UA-12345678-1']); | |
| _gaq.push(['_setDomainName', 'yoursite.com']); | |
| _gaq.push(['_addIgnoredRef', 'yoursite.com']); | |
| _gaq.push(['_trackPageview']); | |
| (function() { | |
| var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
| ar http = require('http'); | |
| var fs = require('fs'); | |
| var util = require('util'); | |
| var fileCache; | |
| var sendFile = function(conn, file) { | |
| conn.writeHead(200, {"Content-Type": "text/html", "Content-Length": file.length}); | |
| conn.write(file); | |
| conn.end(); | |
| } |