Skip to content

Instantly share code, notes, and snippets.

Brendan McKenzie brendanmckenzie

Block or report user

Report or block brendanmckenzie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c3d1990f7206536c9a62
interface IValidatable
{
bool Validate();
IEnumerable<ValidationError> ModelErrors { get; }
}
namespace App.Model
{
public class Client : IValidatable
{
View gist:3c773535382dcad6736b
* app/
* scripts/
* app.js
* controllers/
* HomeCtrl.js
* styles/
* site.less (@imports vendor CSS/LESS files)
* views/
* home.html
* vendor/
View gist:460cd494543af04f82bf
from sqlalchemy import create_engine, Table
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
DB_DSN = 'postgresql+psycopg2://@/db'
__engine__ = create_engine(DB_DSN)
__base__ = declarative_base()
__base__.metadata.bind = __engine__
View gist:2a323e3c6f12e5161538
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')({lazy:false}),
less = require('gulp-less'),
path = require('path'),
historyApiFallback = require('connect-history-api-fallback'),
inject = require('gulp-inject')
mainBowerFiles = require('main-bower-files')
jshint = require('gulp-jshint');
gulp.task('scripts-dist', ['copy-index-dist'], function() {
View cors.py
from config import WEB_ROOT
def init_cors(app):
@app.after_request
def add_cors_headers(response):
response.headers.add('Access-Control-Allow-Origin', WEB_ROOT)
response.headers.add('Access-Control-Allow-Credentials', 'true')
response.headers.add('Access-Control-Allow-Headers', 'Content-Type')
return response
View gist:262dd7f1582310437671
vagrant@vagrant:~$ sudo apt-get install php5-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
php-pear
The following NEW packages will be installed:
php5-fpm
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 2,192 kB of archives.
View gist:a9ac2d889e122541a67f
def init_errors(app):
messages = {
400: 'Bad request.',
401: 'Unauthorised.',
403: 'Forbidden.',
404: 'Not found.',
405: 'Method not allowed.',
406: 'Not acceptable.',
500: 'Server error.'
}
View gist:827d94a62c4c95d8e154
This file has been truncated, but you can view the full file.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'install' ]
2 info using npm@1.3.10
3 info using node@v0.10.25
4 verbose readDependencies using package.json deps
5 verbose install where, deps [ '/home/vagrant/projects/takeoffgo-web',
5 verbose install [ 'connect-history-api-fallback',
5 verbose install 'gulp',
5 verbose install 'gulp-angular-templatecache',
View gist:aa6491f852495fff4d35
from tempfile import mkdtemp
from datetime import datetime
from envelopes import Envelope, SMTP
from task_queue.app import app
import requests
from utils import process_template
from config import SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_TLS
from model import Session, EmailMessage
View gist:77b1097a49774d3d5edb
from os import unlink
from uuid import uuid3, NAMESPACE_DNS
from task_queue.app import app
from utils import upload, pdf, html
from model import Session, AgencyPdf
def upload_pdf(pdf_file):
file_name = str(uuid3(NAMESPACE_DNS, 'takeoffgo.com')) + '.pdf'
path = 'pdf/' + file_name
You can’t perform that action at this time.