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
# Note (November 2016): | |
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information | |
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name yourserver.com; | |
root /path/to/your/htdocs; |
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
# | |
# CORS header support | |
# | |
# One way to use this is by placing it into a file called "cors_support" | |
# under your Nginx configuration directory and placing the following | |
# statement inside your **location** block(s): | |
# | |
# include cors_support; | |
# | |
# As of Nginx 1.7.5, add_header supports an "always" parameter which |
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 | |
# | |
# This script provides start/stop/restart/status control | |
# over the JVM-based API service. | |
# | |
# Build Environment | |
BUILD_NAME="your-build-name" | |
BASE_DIR="/home/ubuntu/${BUILD_NAME}-deploy" |
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
/* | |
* Simple test of PhantomJS and the XContentReady event. | |
* | |
* This is the basic pattern used for the ember-prerender project: https://github.com/zipfworks/ember-prerender | |
* More info on the XContentReady event: https://github.com/n-fuse/the-XContentReady-Event/ | |
* | |
* Usage: phantomjs phantom_test.js | |
*/ | |
var page = require('webpage').create(); |
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
// | |
// This script is useful for managing time series or log data | |
// that is stored in MongoDB. | |
// | |
// I'm currently using logstash to store system logs in MongoDB, where | |
// each database name denotes type of log and each collection name | |
// reflects the date on which the log entries it contains occurred. | |
// | |
// This script expects database collections to be in YYYY.MM.DD format. | |
// |
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
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= filemtime($path_to_image)) { | |
header('HTTP/1.0 304 Not Modified'); | |
header('Cache-Control: public, max-age=2592000'); | |
header('Last-Modified: Mon, 27 Oct 2014 17:08:41 GMT'); | |
exit(0); | |
} else { | |
header('Content-type: image/jpeg'); | |
header('Cache-Control: public, max-age=2592000'); | |
header('Last-Modified: Mon, 27 Oct 2014 17:08:41 GMT'); | |
echo file_get_contents($path_to_image); |
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
# | |
# Example Dockerfile that builds PhantomJS 2.0 | |
# | |
# Build with: | |
# docker build --rm --tag=phantom2.0:latest . | |
# | |
# Run with: | |
# docker run --name=phantom2.0 phantom2.0 | |
# | |
# Copy the executable to your host machine for distribution: |
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
# | |
# Oracle Java8 Dockerfile | |
# | |
FROM ubuntu | |
RUN apt-get update; \ | |
apt-get install -y \ | |
software-properties-common |
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
// To use: | |
// server.use(requestLogger); | |
function requestLogger(req, res, next) { | |
req._startTime = new Date(); | |
var logRequest = function() { | |
res.removeListener('finish', logRequest); | |
res.removeListener('close', logRequest); | |
var status = res.headersSent && res.statusCode || null; | |
var userAgent = req.headers['user-agent']; |
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/sh | |
# Install coffeescript cli | |
npm -g install coffee-script | |
# Convert all coffeescript files to javascript | |
find . -name "*.coffee" -exec coffee --no-header --bare -c {} \; | |
# Optionally delete original coffee files | |
find . -name "*.coffee" -exec rm {} \; |
OlderNewer