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
#include <stdio.h> | |
class Integer | |
{ | |
public: | |
Integer& Inc(int val) { _Value += val; return *this; } | |
void Print() const { printf("%d", _Value); } | |
void operator=(int rhs) { _Value = rhs; } |
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
/** | |
* Dialogs | |
* Some handy functions to get various types of data from a user using JoptionPane | |
* @author Karl Hobley | |
* @version r23 | |
*/ | |
import javax.swing.*; | |
import javax.swing.filechooser.*; | |
import java.io.File; |
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
from fractions import Fraction | |
import math | |
def circle_point(angle, diameter): | |
return ( | |
math.sin(angle * math.pi * 2) * diameter, | |
math.cos(angle * math.pi * 2) * diameter, | |
) |
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
def route_self(self, request, path_components): | |
""" | |
Override this if you want to use custom routing | |
""" | |
if path_components: | |
# path_components has been set but this page doesn't use custom routing | |
raise Http404 | |
else: | |
return self.serve(request) |
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
from django.template.response import TemplateResponse | |
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern, Resolver404 | |
from wagtail.wagtailcore.models import Page | |
class SuperPage(Page): | |
ajax_template = None | |
def get_context(self, request): |
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
# This gist describes the changes I have made in PR #144 | |
# Add AJAX template (1cb7dcb0b29bd2d20016515b922cfc9ca8de9be4) | |
# ============================================================ | |
# The first of my changes is allowing ajax templates to be specified as an attribute to the page class. | |
# I created a method called get_template() which finds the best template to use for a particular request. | |
# This function is overridable so a developer can have a more advanced configuration if they want. | |
# If this is not filled out, the ajax template will fall back to the standard template. | |
# This addresses a very common pattern in the RCA source. |
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
# Upgrade system | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
# Base packages | |
sudo apt-get install -y git vim sqlite3 build-essential screen | |
sudo apt-get install -y libssl-dev libxml2-dev libxslt-dev | |
sudo apt-get install -y libjpeg-dev libtiff-dev zlib1g-dev libfreetype6-dev liblcms2-dev | |
# Python |
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
from django.http import Http404 | |
from django.core.urlresolvers import RegexURLResolver | |
from django.conf.urls import url | |
from wagtail.wagtailcore.models import Page | |
class SuperPage(Page): | |
""" | |
This class extends Page by adding methods to allow urlconfs to be embedded inside pages |
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
from django.db import models | |
from modelcluster.fields import ParentalKey | |
from wagtail.wagtailcore.models import Page, Orderable | |
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel | |
class Thing(models.Model): | |
... | |
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
# Update apt | |
sudo apt-get update -y | |
# Install base packages | |
sudo apt-get install vim git build-essential sqlite3 screen -y | |
# Git config | |
git config --global user.name "Karl Hobley" | |
git config --global user.email karlhobley10@gmail.com |
OlderNewer