This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// base.html | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var csrf = "{% csrf_token %}"; | |
$.cookie("csrfmiddlewaretoken", csrf); | |
}); | |
</script> | |
// script.js | |
var csrf_func = function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsof -i tcp:8000 # or what ever port # you need to search for | |
kill -9 <PID> # replace <PID> with the process PID you want to kill |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Generated by Django 1.9.2 on 2016-03-11 23:37 | |
from __future__ import unicode_literals | |
from django.db import migrations, models | |
class Migration(migrations.Migration): | |
def foo(apps, schema_editor): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# added this to | |
# ~/.ssh/config | |
Host ec2-52-38-4-225.us-west-2.compute.amazonaws.com | |
User ubuntu | |
IdentityFile ~/foobar.pem | |
IdentitiesOnly yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# django gunicorn script | |
# Generates a Daemon process with Gunicorn. | |
# see processes with ps -aux | |
# tested on: Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-74-generic x86_64), aws ec2 | |
# Runs on apps built with Django==1.9 | |
# Marcus Shepherd <[email protected]> | |
# 3-12-16 | |
NAME=project # REPLACE WITH BASE DIR NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream app_server { | |
server unix:/opt/proc/mysite-gunicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var keycode = event.which; | |
var valid_key = (keycode > 47 && keycode < 58) || | |
(keycode > 64 && keycode < 91) || | |
keycode == 8 || keycode == 48 || | |
keycode == 190; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http_request = new XMLHttpRequest(); | |
http_request.open("GET", "{% url 'api_categories' %}"); | |
http_request.send(null); | |
http_request.onreadystatechange = function(){ | |
var DONE = 4; | |
var OK = 200; | |
if (http_request.readyState === DONE){ | |
if (http_request.status === OK){ | |
console.log(http_request.responseText); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function(){}); |
OlderNewer