Skip to content

Instantly share code, notes, and snippets.

View tony's full-sized avatar
💭
I may be slow to respond.

Tony Narlock tony

💭
I may be slow to respond.
View GitHub Profile
@jim-p
jim-p / gist:10140152
Last active August 29, 2015 13:58
graphics/dri build error
Solution: You have conflicting LLVM includes.
rm -rf /usr/local/include/llvm/ /usr/local/include/llvm-c/
Then rebuild graphics/dri
Build Log:
# env MAKE_JOBS_UNSAFE=yes portupgrade --batch -f dri-9.1.7_3,2
[Reading data from pkg(8) ... - 1427 packages found - done]
---> Reinstalling 'dri-9.1.7_3,2' (graphics/dri)
---> Building '/usr/ports/graphics/dri'
===> Cleaning for dri-9.1.7_3,2
@v
v / test.py
Created May 27, 2012 05:10
PyQt Network Manager
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from PyQt4.QtNetwork import *
import sys
class Render(QWebPage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
@simonoff
simonoff / paginated_collection.js
Created June 15, 2012 15:59 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
class JsonSerializableMixin(object):
def __json__(self):
"""
Converts all the properties of the object into a dict for use in json.
You can define the following in your class
_json_eager_load :
list of which child classes need to be eagerly loaded. This applies
to one-to-many relationships defined in SQLAlchemy classes.
@atr000
atr000 / iching.sh
Created October 4, 2010 15:00
iching.sh - random iching cast
#!/bin/bash
# iching.sh
# casts an i ching
# use: ching [number]
# with number looks up that hexagram, otherwise casts
function cast {
l=0
until [ $l == 6 ]
@mxriverlynn
mxriverlynn / app_steps.js
Created November 26, 2012 21:45
A backbone / marionette state machine for wizard / workflow
MyApp.module('MyApp.SomeBuilder', function(SomeBuilder, App, Backbone, Marionette, $, _){
'use strict';
// Controller
// ----------
SomeBuilder.Controller = Marionette.Controller.extend({
initialize: function(options){
this.navbarRegion = options.navbarRegion;
this.mainRegion = options.mainRegion;
@3kwa
3kwa / qtkit.py
Created April 24, 2012 07:15
PyQT + WebKit application
#!/usr/bin/env python
"""
If you use landslide to create slideshows using markdown, you may have found
yourself repeating endlessly:
+ save source document
+ switch to the terminal to run landslide
+ reload the generated html in your browser
This QT (using webkit) based "application" monitor changes to the source file
@liammclennan
liammclennan / blog_backbone_style.md
Created June 7, 2012 06:33
Backbone.js Style / Patterns

Naming Rules

Use PascalCase for constructors, namespaces and modules:

var m = new Backbone.Model(); 

Prefix private properties with _

This is a convention to compensate for JavaScript's lack of private properties on objects. Being able to identify private methods is important because it tells us that we don't need to test those methods and that they will not be coupled to anything outside of the object.

@imagescape
imagescape / UpgradeDjango.md
Last active June 27, 2018 12:16
Upgrade Django from 1.1 to 1.5.1. This highlights some of the issues that one may encounter when updating Django. It's not possible to cover every case, but this should provide a good general starting point.

Upgrade Django from 1.1 to 1.5.1. This highlights some of the issues that one may encounter when updating Django. It's not possible to cover every case, but this should provide a good general starting point.

Change to DATABASES variable in settings.py.

Django now supports multiple databases and changes are needed to how the database connections are defined.

  • Changed in Django 1.2
  • Change Required by Django 1.4
  • Source:
@alonho
alonho / flask_pdb.py
Created December 27, 2012 15:40
Flask: drop into pdb on exception
def drop_into_pdb(app, exception):
import sys
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem(sys.exc_info()[2])
# somewhere in your code (probably if DEBUG is True)
flask.got_request_exception.connect(drop_into_pdb)