Skip to content

Instantly share code, notes, and snippets.

View lakinwecker's full-sized avatar

Lakin Wecker lakinwecker

  • https://www.structuredabstraction.com
  • Calgary Alberta
View GitHub Profile
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)
# 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("<", "&lt;").replace(">", "&gt;")
return u"""
<html>
<head>
[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:
import operator, re
lookup = {
'-': operator.sub,
'+': operator.add,
'*': operator.mul,
'/': operator.div,
'^': operator.pow,
}
emdas = [['\^'], ['\/\*'], ['\+\-']]
def lwe(expr):
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("> ")))
>>> var = "foo"
>>> print(var)
foo
>>> def bar():
... var = "bar"
... print(var)
...
>>> bar()
bar
>>> print(var)
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)
if (data.size() == 0) {
++buffer_index;
return;
}
#include <iostream>
#include <fstream>
using namespace std;
const int size = 65536;
void store();
double* load();
#!/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