Skip to content

Instantly share code, notes, and snippets.

@kshepp
kshepp / repeatable_content.html
Last active July 14, 2023 06:05
Django Header, Navbar, and Footer
<!-- This loads of all of files that you call below from your 'static' folder -->
{% load staticfiles %}
<!--The static folder consists of your bootstrap files (.css, .js, fonts, etc)-->
<!--When you load the static folders is calls all those folders in the static files without having to code each one in individually-->
<html>
<head>
<!--This is the meta information which is good for SEO-->
{% block head-meta %}
<meta charset="utf-8">
@kshepp
kshepp / Extend_files.html
Created February 19, 2016 14:58
Extending files in Django
{% extends "NAME_OF_YOUR_PROJECT/base.html" %}
{% load static %}
{% block content %}
<!--Insert all of the page specific content here-->
{% endblock %}
@kshepp
kshepp / nltk_parts_of_speech.py
Last active July 6, 2018 07:35
NLTK - Top 50 Most Frequent Part of Speech
from __future__ import division
import nltk, re
from nltk import FreqDist
from nltk import word_tokenize
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import brown
tokenizer = RegexpTokenizer(r'\w+') # Takes out the punctuation that Python can't read
f= open('Conservative.txt').read().decode('utf-8') # open the file
text = word_tokenize(f)
{
"user": {
"name": "John Dough",
"age": 42,
"friends": [
{"name": "Jane Doe"},
{"name": "Bill Green"}
]
}
}
{
user(id: 1) {
name
age
friends {
name
}
}
}
{
"user": {
"name": "John Dough",
"age": 42,
"city": "Tokyo"
}
}
{
user(id: 1) {
name
age
city
}
}
{
user(id: 1) {
name
age
}
}
<ul class="bxslider">
{% for medium in media %}
<div class="item {% if forloop.first %} active {% endif %}">
{% if medium.mediaType == 'video' %}
<li>
<iframe width="640" height="360" src="{{medium.mediaLink}}" frameborder="0" allowfullscreen>
</iframe>
</li>
<a href="{% url 'index' %}">This is my index page!</a>