Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
mattdeboard / it_follows.py
Last active January 19, 2017 17:48
Simulation of the plot of It Follows
#!/usr/bin/env python
import os
import random
class Follower:
def __init__(self, starting_location, current_victim=None):
# `starting_location` is a string representing a file system path.
self.location = starting_location
self.current_victim = current_victim
#!/usr/bin/env python
import os
import random
class Follower:
def __init__(self, starting_location, current_victim=None):
# `starting_location` is a string representing a file system path.
self.location = starting_location
self.current_victim = current_victim
@mattdeboard
mattdeboard / .dir-locals.el
Created January 9, 2017 22:25
This is the right variable to override for jedi in emacs to make Jedi understand where the darn virtualenv lives.
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((python-mode
(python-shell-virtualenv-path . "/Users/mdeboard/Envs/sumo")))
@mattdeboard
mattdeboard / num_to_string.py
Last active March 2, 2020 18:10
Turns abitrary number into its string representation (e.g. 100 -> "one hundred") up to 999,999,999,999,999,999,999,999,999,999,999,999,999
#!/usr/bin/env python
from math import ceil, floor, log10
ones = {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
;; Version 1
{:user {:plugins [[luminus/lein-template "2.9.10.74"]]}
:repl {:dependencies [[cider/cider-nrepl "0.15.0-snapshot"]]}}
;; Version 2
{:user {:plugins [[luminus/lein-template "2.9.10.74"]]
:dependencies [[cider/cider-nrepl "0.15.0-snapshot"]]}}
guestbook.db.core> (require '[guestbook.core :refer :all])
nil
guestbook.db.core> (mount.core/start #'*db*)
ClassCastException mount.core.DerefableState cannot be cast to clojure.lang.IFn guestbook.db.core/eval4338/fn--4339 (core.clj:11)
guestbook.db.core>
;; Running `clojure-jack-in' here
(ns guestbook.db.core
(:require
[conman.core :as conman]
[mount.core :refer [defstate]]
[guestbook.config :refer [env]]))
(defstate ^:dynamic *db*
:start (conman/connect!
{:datasource
require('normalize.css/normalize.css');
require('styles/App.css');
require('codemirror/lib/codemirror.css');
import React from 'react';
import Paste from './Paste';
import LanguageStore from '../stores/LanguageStore';
import Constants from '../AppConstants';
import { codemirror } from '../../cfg/base.js';
create table mydata_real (id serial, date date, value text);
create table mydata_real_y2015 (check (date >= '2015-01-01' and date < '2016-01-01')) inherits (mydata_real);
create table mydata_real_y2016 (check (date >= '2016-01-01' and date < '2017-01-01')) inherits (mydata_real);
create function mydata_nope() returns trigger language plpgsql
as $f$ begin raise exception 'insert on wrong table'; return NULL; end; $f$;
create trigger mydata_nope before insert on mydata_real execute procedure mydata_nope();
create view mydata as select * from mydata_real;
@mattdeboard
mattdeboard / change.py
Last active May 2, 2016 22:34
This was my first web app ever, for a school project.
from flask import Flask, request, render_template
from flaskext.wtf import Form, FloatField, Required
app = Flask(__name__)
app.secret_key = 'b\xcaf\xde\xc3\xc6\xdc\x03\xf0ls\xd6\x08\xe7\x9a2\x02j\xdf\xa7n\xe5\xf4\xdd'
class ChangeForm(Form):
cost = FloatField("Total cost of item: $")
tender = FloatField("Amount tendered: $")