Skip to content

Instantly share code, notes, and snippets.

@foxbunny
foxbunny / mailer.js
Created July 29, 2011 14:32
Nodemailer wrapper
var fs = require('fs'),
path = require('path'),
nodemailer = require('nodemailer'),
template = require('template'),
cache = {},
config = require('../config');
function MailerError(msg) {
this.msg = msg;
}
@tomshaw
tomshaw / app.js
Created August 6, 2011 02:53
A nodemailer wrapper library that makes it easy to send emails using Express and Jade templates.
/*!
* MailWrapper - An extremely simple nodemailer wrapper library that makes it easy to send emails using Express and Jade templates. Originally
* developed to practice and learn how to write modules for node.
*
* Copyright(c) 2011 Tom Shaw <tom@tomshaw.info>
* MIT Licensed
*/
var mailer = require('./lib/mailer');
@bradmontgomery
bradmontgomery / ShortIntroToScraping.rst
Created February 21, 2012 02:00
Really short intro to scraping with Beautiful Soup and Requests
@sholloway
sholloway / PostGIS install
Created January 13, 2013 23:23
Set up a spatial database with PostGIS on EC2 using an EBS.
Steps:
Set up EBS
21Created 1 TB EBS
Created 64 Bit Amazon Linux AMI 2012.09 M1 Medium 3.7 gb ram, 2 ECUs
Connect to ec2 instance via ssh
chmod 400 IFS-KeyPair.pem
ssh -v -i IFS-KeyPair.pem ec2-user@ec2-54-234-14-65.compute-1.amazonaws.com
Note: Do not replace ec2-user with your user id. This is a AWS Amazon AMI requirement.
@braking
braking / ExplodingTabBar.m
Created May 23, 2013 11:58
A custom UITabBar with a big unique center button that animates 3 buttons out of the center from any view.
#import "CustomTabBarViewController.h"
@interface CustomTabBarViewController ()
@property (nonatomic, assign) BOOL buttonsExpanded;
@end
@implementation CustomTabBarViewController
-(void) addCenterButtonWithImage:(UIImage*)buttonImage highlightImage:(UIImage*)highlightImage
{
@postrational
postrational / gunicorn_start.bash
Last active April 4, 2024 12:48
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of MKMapView
Last active February 8, 2021 08:46
Sample iOS Unit Tests: Working with a ViewController composed of MKMapView
import UIKit
import XCTest
import MapKit
class ExampleTests: XCTestCase {
//declaring the ViewController under test as an implicitly unwrapped optional
var viewControllerUnderTest : ViewController!
override func setUp() {
@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active June 20, 2024 17:13
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all
@GrahamDumpleton
GrahamDumpleton / gist:b380652b768e81a7f60c
Last active May 18, 2024 03:35
Setting environment variables for Apache/mod_wsgi hosted Python application.

Django documentation says to use:

WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
WSGIPythonPath /path/to/mysite.com

<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Require all granted
@ColinEberhardt
ColinEberhardt / Swift Events
Created February 11, 2015 09:15
An eventing mechanism for Swift
/// An object that has some tear-down logic
public protocol Disposable {
func dispose()
}
/// An event provides a mechanism for raising notifications, together with some
/// associated data. Multiple function handlers can be added, with each being invoked,
/// with the event data, when the event is raised.
public class Event<T> {