Skip to content

Instantly share code, notes, and snippets.

@shakna-israel
shakna-israel / nginx.conf
Created January 14, 2015 09:16
Nginx Reverse Proxy
server {
listen 80;
server_name example.org;
access_log /var/log/nginx/example.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@shakna-israel
shakna-israel / serve.py
Created January 13, 2015 04:43
CherrPy QuickServe
import cherrypy
import os.path
current_dir = os.path.dirname(os.path.abspath(__file__))
class RootPage:
def index(self):
raise cherrypy.HTTPRedirect("/static/index.html")
@shakna-israel
shakna-israel / gist:b213d04045882db3b381
Created November 23, 2014 07:11
This does not process as sass, due to liquid.
---
---
{% for posts in site.posts %}
#{{ post.id }} {
overflow:hidden;
width:100%;
height:auto;
background-image:url("{{ "assets/img/" | append post.img }}")
}
@shakna-israel
shakna-israel / compress.sh
Created October 27, 2014 12:30
Automatic Image Compression Script
# Requires jpegoptim, pngquant, optipng, gifsicle as well as scour and python.
# The scour.py file should be located at ~/scour/scour.py
# IMPORTANT: This script OVERWRITES existing image files.
# Licensed under the MIT License
# The MIT License (MIT)
@shakna-israel
shakna-israel / googlecalendarapicurrentevents
Created August 8, 2014 06:14
Google Calendar - Current Events via API
<script type="text/javascript">
<!--
/**
* Converts an xs:date or xs:dateTime formatted string into the local timezone
* and outputs a human-readable form of this date or date/time.
*
* @param {string} gCalTime is the xs:date or xs:dateTime formatted string
* @return {string} is the human-readable date or date/time string
*/
function formatGCalTime(gCalTime) {