Skip to content

Instantly share code, notes, and snippets.

@mariocesar
mariocesar / nginx_dynamic_host.conf
Created December 30, 2013 19:20
NGINX Vhost configuration to serve dynamic virtual host using domain names as the website router
server {
index index.html index.php index.htm;
server_name ~^(www\.)?(?P<domain>.+)$;
root /var/www;
location @notfound {
root /home/websites/Websites;
access_log on;
rewrite ^ /404.html last;
}
@zeroasterisk
zeroasterisk / function
Created April 11, 2013 05:10
Example usage of Handlebars.registerHelper("foreach"... from http://stackoverflow.com/a/12002281/194105
Handlebars.registerHelper("foreach",function(arr,options) {
if(options.inverse && !arr.length)
return options.inverse(this);
return arr.map(function(item,index) {
item.$index = index;
item.$first = index === 0;
item.$last = index === arr.length-1;
return options.fn(item);
}).join('');
@kosso
kosso / background.html
Created March 2, 2012 13:40 — forked from mohamedmansour/background.html
Google Chrome Extension to upload a locally stored image to imgurl API service.
<!DOCTYPE html>
<html>
<head>
<script>
const API_KEY = 'SOME_KEY';
/**
* Use HTML5 Canvas to get the image data
* @param {HTMLImageElement} img An Image Tag