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
/* Quick and dirty, should be wrapped better but this is just a demo */ | |
var app = app || {}; | |
app.apikeys = app.apikeys || {}; | |
app.urls = app.urls || {}; | |
app.methods = app.methods || {}; | |
app.apikeys.zillow = 'YOUR API KEY HERE'; | |
app.urls.zillow = { |
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
#!/bin/bash | |
if [[ $EUID -eq 0 ]]; then | |
error "This script should not be run using sudo or as the root user." | |
exit 1 | |
fi | |
command -v curl >/dev/null 2>&1 || { echo >&2 "Curl is required to install NVM. Install it using 'sudo apt-get install curl' on Ubuntu. Aborting."; exit 1; } | |
command -v git >/dev/null 2>&1 || { echo >&2 "Git is required to clone the code structure. Install it using 'sudo apt-get install git' on Ubuntu. Aborting."; exit 1; } |
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
sudo sed -i -e 's/mirror.rackspace.com\|archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list |
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
sudo apt-get update && sudo apt-get upgrade -y; | |
sudo apt-get build-dep -y libqt4-gui libqt4-network libqt4-webkit; | |
sudo apt-get install -y openssl build-essential xorg git git-core libssl-dev libxrender-dev t1-xfree86-nonfree xfonts-scalable ttf-ubuntu-font-family ttf-mscorefonts-installer poppler-utils libqt4-dev qt4-dev-tools; | |
cd ~; | |
git clone git://gitorious.org/~antialize/qt/antializes-qt.git wkhtmltopdf-qt; | |
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf; | |
cd wkhtmltopdf; | |
qmake-qt4; | |
cd ../wkhtmltopdf-qt; | |
git checkout 4.8.4; |
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
$mtkb('.fancybox').fancybox( | |
{ | |
hideOnContentClick : true, | |
width: 382, | |
autoDimensions: true, | |
type : 'iframe', | |
showTitle: false, | |
scrolling: 'no', | |
onComplete: function(){ |
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 exec = require('child_process').exec; | |
var spawn = require('child_process').spawn; | |
var fs = require('fs'); | |
/** | |
* @param pdf_path path to the single page searchable pdf file on disk | |
* This function buffers all the output from stdout and sends it back as a string. | |
* Since we only handle single pages of pdf text here the amount of text is small | |
* and therefore we don't need to use a stream |
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 fs = require('fs'); | |
var file = fs.readFileSync('./file/location/here.json'); | |
file = JSON.parse(file); // this needs to be valid json or it will throw an error | |
var Client = require('./location/of/models/clients.js'); | |
var output = new Client(file); | |
console.log(output); | |
// or if you're doing a scenario | |
var Scenario = require('./location/of/models/scenarios.js'); |
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 regex = /^http:\/\/appjs/; | |
appjs.router.handle = function(req, res, next) { | |
req.url = req.url.replace(regex, ''); | |
app.handle.apply(app, arguments); | |
} |
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
app.get('/admin/uploads', authenticateUser, isAdmin, function(req, res) { | |
res.render('admin/upload'); | |
}); | |
app.post('/admin/uploads', authenticateUser, isAdmin, function(req, res) { | |
var format = require('util').format; | |
console.log(format, req.files.upload.name); | |
res.send(format('\nuploaded %s (%d Kb) to %s as %s' | |
, req.files.upload.name | |
, req.files.upload.size / 1024 | 0 |
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
node_modules/ |