Skip to content

Instantly share code, notes, and snippets.

View chrisjones-brack3t's full-sized avatar

Chris Jones chrisjones-brack3t

View GitHub Profile
import UIKit
class SettingsTableViewController: UITableViewController {
let items: [String] = ["Some", "Text", "For", "The", "Cells"]
override func viewDidLoad() {
super.viewDidLoad()
let tableCell = UITableViewCell.self
tableView.registerClass(tableCell, forCellReuseIdentifier: "cell")
@chrisjones-brack3t
chrisjones-brack3t / example.swift
Created December 16, 2014 05:57
Passing objects
# Inside table view
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let game = self.games[self.tableView.indexPathForSelectedRow()!.row]
var detailView = segue.destinationViewController as GameDetailView
detailView.game = game
}
# Detail View
import UIKit

Keybase proof

I hereby claim:

  • I am chrisjones-brack3t on github.
  • I am tehjones (https://keybase.io/tehjones) on keybase.
  • I have a public key whose fingerprint is D209 4832 7A84 0EA7 6BBF D255 4017 BB41 9BD6 AE7B

To claim this, I am signing this object:

class SSLRequiredMixin(object):
""" """
raise_exception = False # Default whether to raise an exception to none
def dispatch(self, request, *args, **kwargs):
# if getattr(settings, 'DEBUG', False):
# return super(SSLRequiredMixin, self).dispatch(
# request, *args, **kwargs)
if not request.is_secure():
## common/models.py
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class CommonFile(models.Model):
""" Model for common files. """
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
order = PositionField(unique_for_field='object_id')
@chrisjones-brack3t
chrisjones-brack3t / hello.go
Created September 28, 2015 21:47
Simple test of micropackage
package hello
import "fmt"
// SayHello says hello!
func SayHello() {
fmt.Println("HELLO!")
}
@chrisjones-brack3t
chrisjones-brack3t / local.py
Created October 2, 2015 18:21
Disable migrations during tests
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return 'notmigrations'
# ENABLE THIS TO SPEED UP TESTS
MIGRATION_MODULES = DisableMigrations()
<HTML>
<HEAD>
<TITLE>Trouble</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 link="#000000" alink="#000000" vlink="#666666">
<% If Request.QueryString("Action") = "" Then %>
<%
If Session.Contents("Browse") <> "Yes" Then
Response.Redirect("index.asp")
assert = require 'assert'
request = require 'request'
app = require '../../app'
describe "authentication", ->
describe "GET /login", ->
body = null
before (done) ->
options =
@chrisjones-brack3t
chrisjones-brack3t / SublimeLinter.sublime-settings
Created July 24, 2012 00:10
Sublime Text 2 Linter settings
/*
SublimeLinter default settings
*/
{
/*
Sets the mode in which SublimeLinter runs:
true - Linting occurs in the background as you type (the default).
false - Linting only occurs when you initiate it.
"load-save" - Linting occurs only when a file is loaded and saved.