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)
<?php
/**
* @file
* Begin the process of additing additonal user utilities.
*/
/**
* Implementation of hook_drush_command().
*/
/*
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>
@rom3r4
rom3r4 / gist:7149525
Created October 25, 2013 04:43
newVOA3R. NGINX config for a Drupal 7 Site
server {
listen *:80;
server_name ___ENTER_YOUR_SITE_URL_HERE___;
root /___PATH_TO_YOUR_DRUPAL_FILES_WITHOUT_TRAILING_DASH___;
index index.php;
access_log off;
@rom3r4
rom3r4 / gist:7540201
Created November 19, 2013 04:10
Using handlebars templates with marionette
The easiest way to use Handlebars with Marionette, including support for AMD / RequireJS, is with the Marionette.Handlebars add-on from @AsciiDisco.
Note that this plugin is not yet compatible with Marionette > 0.9.x.
Alternatively, you can use the following code in your main application or main.js file:
Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
return Handlebars.compile(rawTemplate);
};
Enhanced Handlebars integration with Marionette https://gist.github.com/funkjedi/5732611
/**
* 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: