Skip to content

Instantly share code, notes, and snippets.

Avatar
🙈
Taking care of my kid

Matt Wright mattupstate

🙈
Taking care of my kid
View GitHub Profile
@mattupstate
mattupstate / windowResize.coffee
Created Dec 4, 2013
A generic window resize directive to which you can add to any element to call a function on your controller
View windowResize.coffee
angular.module('something')
.directive 'windowResize', ($window, $parse) ->
restrict: 'A'
link: (scope, element, attrs) ->
w = angular.element($window)
fn = $parse(attrs['windowResize'])
handler = (event) ->
@mattupstate
mattupstate / gist:7010498
Created Oct 16, 2013
Flask-Mail Log Handler
View gist:7010498
import logging
from flask_mail import Message
class FlaskMailLogHandler(logging.Handler):
def __init__(self, mail, sender, recipients, subject, *args, **kwargs):
super(FlaskMailLogHandler, self).__init__(*args, **kwargs)
@mattupstate
mattupstate / virtualbox.json
Created Sep 3, 2013
Ubuntu 12.04 VirtualBox Packer example
View virtualbox.json
{
"provisioners": [
{
"type": "shell",
"scripts": [
"scripts/base.sh",
"scripts/vagrant.sh",
"scripts/virtualbox.sh",
"scripts/ruby.sh",
"scripts/chef.sh",
@mattupstate
mattupstate / module.sublime-snippet
Created Jul 19, 2013
A simple Python module header snippet for Sublime Text
View module.sublime-snippet
<snippet>
<tabTrigger>module</tabTrigger>
<scope>source.python</scope>
<description>Module</description>
<content><![CDATA[# -*- coding: utf-8 -*-
"""
${1:name}
${1/./~/g}
@mattupstate
mattupstate / helpers.py
Created Jun 25, 2013
Register all Blueprint instances on the specified Flask application found in all modules for the specified package
View helpers.py
# -*- coding: utf-8 -*-
"""
helpers
~~~~~~~
helpers module
"""
import pkgutil
import importlib
@mattupstate
mattupstate / Vagrantfile
Last active Dec 13, 2015
RabbitMQ cluster with Vagrant and Chef
View Vagrantfile
Vagrant::Config.run do |vagrant|
vagrant.vm.define :vm1 do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :hostonly, "192.168.0.80"
config.vm.host_name = 'rabbit1'
config.vm.provision :chef_solo do |chef|
chef.add_recipe "apt"
chef.add_recipe "hostsfile"
@mattupstate
mattupstate / Scale to Fit.jsx
Created Aug 22, 2012
Photoshop script to scale an image to fill a specified rectangle and preserve aspect ratio. Save this in <Photoshop Install Folder>/Presets/Scripts and restart Photoshop.
View Scale to Fit.jsx
#target photoshop
main ();
function cloneRectangle(rect) {
return { x:rect.x, y:rect.y, width:rect.width, height:rect.height };
}
function rectangle(x, y, width, height) {
return { x:x, y:y, width:width, height:height };
View configure_nginx.yml
---
- hosts: testing
user: ubuntu
sudo: True
vars_files:
- software/nginx/vars/default.yml
tasks:
@mattupstate
mattupstate / supervisord.sh
Created Apr 19, 2012
Super simple supervisor init.d script
View supervisord.sh
# Supervisord auto-start
#
# description: Auto-starts supervisord
# processname: supervisord
# pidfile: /var/run/supervisord.pid
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=supervisord
DESC="supervisod is a system for controlling process state"
SUPERVISORD=/usr/local/bin/supervisord
@mattupstate
mattupstate / app.py
Created Mar 15, 2012
Flask application configuration using an environment variable and YAML
View app.py
os
from flask_extended import Flask
app = Flask(__name__)
app.config.from_yaml(os.join(app.root_path, 'config.yml'))
You can’t perform that action at this time.