Skip to content

Instantly share code, notes, and snippets.

@hugohn
hugohn / Django EC2 Ubuntu
Created May 24, 2016 08:31 — forked from eezis/Django EC2 Ubuntu
Django on Amazon EC2 using Ubuntu
ALSO SEE THIS: http://eddychan.com/post/18484749431/minimum-viable-ops-deploying-your-first-django-app-to
AND THIS: http://bitnami.com/stack/django
These are my notes on how to quickly setup a python, virtualenv (use virtualenv-burrito FTW), and django.
Setup an EC-2 instance:
=======================
Use the quick launch wizard:
@hugohn
hugohn / app.js
Last active August 29, 2015 14:28 — forked from dbainbridge/app.js
How to use socket.io with Express 3
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
var CreateAccountForm = React.createClass({
propTypes: {
buttonText: React.PropTypes.string,
isInline: React.PropTypes.bool
},
getInitialState: function() {
return {
error: '',
password: '',
emailAddress: '',
@hugohn
hugohn / slug.js
Last active August 29, 2015 14:22 — forked from bentruyman/slug.js
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};