Skip to content

Instantly share code, notes, and snippets.

# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
/*
Copyright (c) 2011 Damien Antipa, http://www.nethead.at/, http://damien.antipa.at
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>Drag And Drop</title>
</head>
<body>
<div id="viz"></div>
/**
* HandleBars remote template loader
*
* Allows for direct insertion into dom if jQuery selector string is passed (el).
* Returns $.ajax promise regardless so code can attach callbacks externally.
*
* @example
* // Direct insertion into dom
* Handlebars.renderFromRemote('/media/templates/hello.handlebars', { name: 'Ryan' }, '#content');
*
@rom3r4
rom3r4 / iso639.js
Created November 23, 2013 17:05 — forked from Loddan/iso639.js
#!/usr/bin/env node
var jsdom = require('jsdom');
var wikipedia = 'http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes';
var jquery = 'http://code.jquery.com/jquery.js';
jsdom.env(wikipedia, [jquery], function (errors, window) {
var $ = window.$;
var tds = $('table[class="wikitable sortable"] > tr > td');
if (tds.size() % 10 != 0) {
@rom3r4
rom3r4 / gist:8088767
Created December 22, 2013 21:41 — forked from ches/gist:243611
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
Warden::Manager.before_failure do |env,opts|
# Sinatra is very sensitive to the request method
# since authentication could fail on any type of method, we need
# to set it for the failure app so it is routed to the correct block
env['REQUEST_METHOD'] = "POST"
end

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
language: php
php:
- 5.3
mysql:
database: drupal
username: root
encoding: utf8
source 'http://rubygems.org'
gem 'rack'
gem 'rack-flash'
gem 'thin'
gem 'sinatra', :require => 'sinatra/base'
gem 'mongoid'
gem 'bson_ext'
gem 'slim'