Skip to content

Instantly share code, notes, and snippets.

@DeadWisdom
DeadWisdom / scrabble.py
Created December 7, 2011 10:07
Scrabble.py
def scrabble(dictionary_path, letters, max=10):
results = []
letters = set(letters)
for word in open(dictionary_path):
word = word.strip()
if letters == set(word):
results.append(word)
results.sort(key=len)
results.reverse()
return results[:max]
--- Layout ---
bundles/
bundle_lib.js
base/
compiled_javascript.js
compiled_css.css
iphone/
compiled_javascript.js
compiled_css.css
Person = Tea.Object.extend({
type: 'person',
name: null,
__init__ : function() {
console.log("New person made named: " + this.name);
},
foo : function(args) {
console.log("Bar");
}
});
@DeadWisdom
DeadWisdom / core.js
Created January 19, 2013 23:09
Core functionality of Tea
/** Tea
Complex UI framework based on jQuery.
Copyright (c) 2012 Brantley Harris. All rights reserved.
**/
(function() {
var Tea = window.Tea = (window.Tea == undefined ? {root: ''} : window.Tea);
@DeadWisdom
DeadWisdom / gist:5009038
Created February 21, 2013 22:37
Simple javascript that blurs out all the links that have href="#" when you hold down the apple key (change it to something else if you don't like it). Requires jQuery, imagine that.
$(function() {
function getColor(item){
var rgb = $(item).css('color');
return rgb.substring(4, rgb.length - 1);
}
$(window).keydown(function(e) {
if (e.keyCode == 224) {
$('a[href=#]').each(function(i, element) {
var item = $(element);
@DeadWisdom
DeadWisdom / un-class-based-views.py
Last active December 16, 2015 03:29
This is a recreation of the view found here: https://github.com/jacobian/djobs/blob/master/jobs/views.py It is intended to show how class based views add unneeded complexity and should only be used in limited scenarios. It is *NOT* intended to be a criticism of the author in any way. I am merely using it as an example because it was brought to m…
import json
from django.contrib import messages
from django.core import urlresolvers
from django.db.models import Q, Count
from django.shortcuts import get_object_or_404, redirect, render
from django.contrib.auth.decorators import login_required, user_passes_test
from django.views.decorators.http import require_POST
from taggit.models import Tag
@DeadWisdom
DeadWisdom / mystaticlang
Created October 11, 2013 08:21
A mythical language that features heavy type-inference and no templating, cause templating sucks, yo.
import "stdio.h"
class Object {
@collected;
int x = 1;
float y = 2.0;
void init(self, x, *args) {
self.x = x;
able
about
above
abuse
accept
accuse
across
act
actor
add
38% Chance to Avoid being Stunned
30% Chance to Dodge Spell Damage
20% Elemental Resistances while holding a Shield
+2 Life gained for each enemy hit by your Attacks
+30 Life gained on Kill
+40 Mana Gained on Kill
+3 Maximum Endurance Charge
+3 Maximum Frenzy Charge
+3 Maximum Power Charge
19% additional Block Chance With Staves
https://dl.dropboxusercontent.com/u/622809/England.eu4