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 get_name_grouping(self): | |
first_letter = self.name[0] | |
if first_letter in ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"): | |
return "0-9" | |
return first_letter | |
grouping = property(get_name_grouping) |
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
# coding=utf-8 | |
import cherrypy | |
class HelloWorld(object): | |
def index(self, data=None, foo=None): | |
if data: | |
return (u"Hello World: {0} {1}".format(type(data), data)).replace("<", "<").replace(">", ">") | |
return u""" | |
<html> | |
<head> |
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] javascript/dijit | |
Note: checking out '1.9.8'. | |
You are in 'detached HEAD' state. You can look around, make experimental | |
changes and commit them, and you can discard any commits you make in this | |
state without impacting any branches by performing another checkout. | |
If you want to create a new branch to retain commits you create, you may | |
do so (now or later) by using -b with the checkout command again. Example: |
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
import operator, re | |
lookup = { | |
'-': operator.sub, | |
'+': operator.add, | |
'*': operator.mul, | |
'/': operator.div, | |
'^': operator.pow, | |
} | |
emdas = [['\^'], ['\/\*'], ['\+\-']] | |
def lwe(expr): |
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 operator import * | |
lookup = { '-': sub, '+': add, '*': mul, '/': truediv, '^': pow} | |
def lwe(e): | |
for ops in ['+-', '/*', '^']: | |
i = max([e.rfind(c) for c in ops]) | |
if i != -1: return lookup[e[i:i+1]](lwe(e[:i]), lwe(e[i+1:])) | |
return float(expr) | |
print(lwe(input("> "))) |
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
>>> var = "foo" | |
>>> print(var) | |
foo | |
>>> def bar(): | |
... var = "bar" | |
... print(var) | |
... | |
>>> bar() | |
bar | |
>>> print(var) |
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
library(ggplot2) | |
rating_vs_happiness <- read.csv("stats.csv") | |
image <- ggplot(rating_vs_happiness, aes(Happiness, RatingRange, group=Source)) + | |
geom_point(aes(colour=Source, shape=Source, size=Source)) + | |
scale_shape_manual(values=c(1, 13)) + | |
scale_size_manual(values=c(1, 5)) | |
image | |
ggsave(file="random-vs-snakedraft.svg", plot=image, width=10, height=8) |
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
if (data.size() == 0) { | |
++buffer_index; | |
return; | |
} |
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 <iostream> | |
#include <fstream> | |
using namespace std; | |
const int size = 65536; | |
void store(); | |
double* load(); |
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
#!/usr/bin/python | |
import smtplib | |
sender = 'server@littlecornbb.com' | |
receivers = ['info@littlecornbb.com'] | |
message = """From: Little Corn Beach & Bungalow <server@littlecornbb.com> | |
To: Little Corn Beach & Bungalow <info@littlecornbb.com> | |
Subject: Lakin is testing sending mail x3 |
OlderNewer