Skip to content

Instantly share code, notes, and snippets.

@bool-dev
bool-dev / gist:e3fb15e0e328bd2ec7c3
Last active November 24, 2015 15:19
Sample CORS config for a bucket on S3 to serve static assets
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>http://example.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
<CORSRule>
@bool-dev
bool-dev / sendy-server
Created November 25, 2015 12:09 — forked from refringe/sendy-server
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen 80;
listen [::]:80;
server_name domain.com;
autoindex off;
index index.php index.html;
root /srv/www/domain.com/public;
@bool-dev
bool-dev / nginx.default.conf
Created November 25, 2015 13:36 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
"""
Sample DecimalField.
"""
from wtforms import DecimalField
class BetterDecimalField(DecimalField):
"""
Very similar to WTForms DecimalField, except with the option of rounding
@bool-dev
bool-dev / Jinja module loader.md
Created February 8, 2016 10:46 — forked from voscausa/Jinja module loader.md
Jinja2 compiled templates module loader for App Engine Pyhton 2.7.

Jinja compiled templates module loader

This code is part of a Jinja CMS for Google App Engine Python 2.7 and NDB datastore

A Jinja enviroment is created for every CMS site: site_key_id = 'example

The modules are created using compiler.py The resulting code objects are stored in the dadastore using Kind Runtimes and a BlobProperty

The modules can also be saved / downloaded as .pyc in a zip archive: -compiled-templates.zip

@bool-dev
bool-dev / post-merge
Created February 12, 2016 16:38 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@bool-dev
bool-dev / gist:5b124f72590cda3d5f13
Created March 7, 2016 23:08 — forked from gcatlin/gist:1847248
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@bool-dev
bool-dev / nginx.conf
Created May 27, 2016 11:15 — forked from jmervine/nginx.conf
Nginx config to test regex.
# Usage:
#
# Start with:
#
# sudo /use/local/sbin/nginx -c /path/to/this/nginx.conf
#
# Tail logs:
#
# $ sudo tail -f /tmp/access.log /tmp/error.log /tmp/match.log
#
@bool-dev
bool-dev / ladder.md
Created June 8, 2016 08:38 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder