Skip to content

Instantly share code, notes, and snippets.

View joelburget's full-sized avatar

Joel Burget joelburget

View GitHub Profile
@joelburget
joelburget / models.py
Created July 26, 2011 17:35
Don't save empty UserData
class UserData(db.Model):
...
def put(self, **kwargs):
# Only store the UserData if there is something worth storing
if self.points > 0 or self.coaches != [] or self.student_lists != [] \
or self.moderator:
super(UserData, self).put(**kwargs)
@joelburget
joelburget / gist:1110568
Created July 27, 2011 23:13
Not removing?
filename = os.path.join(os.path.dirname(__file__), \
'../js_css_packages/packages_hash.py')
if os.path.isfile(filename):
print "\n\n\n%s\n\n\n" % filename
os.remove(filename)
# file not removed but prints 'deploy/../js_css_packages/packages_hash.py'
<!DOCTYPE html>
<html>
<head>
<title>Gravity!</title>
<script src="processing.js"></script>
</head>
<body>
<canvas id="pjs" width="400" height="400"></canvas>
<script data-processing-target="pjs">
var canvas = document.getElementById("pjs");
@joelburget
joelburget / lenses.js
Created January 10, 2014 21:51
js lenses
var getter = function(obj, lens) {
return _(lens).foldl(function(focused, element) {
return focused[element];
}, obj);
};
var modifier = function(obj, lens, mod) {
if (lens.length === 0) {
return mod(obj);
} else {
@joelburget
joelburget / ProjectFeedback.jsx
Last active January 4, 2016 17:39 — forked from pamelafox/ProjectFeedback.jsx
nolint example
/* This class is used to create the /topic/projectfeedback page,
* which shows expandable lists of feedback requests that need answering.
*/
var ProjectFeedbackPage = React.createClass({
propTypes: {
topic: React.PropTypes.string.isRequired
},
render: function() {
var helpCollection = new DiscussionItemCollection([], {
topic: this.props.topic,
data Matrix : Vect n Nat -> Type -> Type where
Mat : (foldr Vect a dims) -> Matrix (Vect n Nat) a
var Button = React.createClass({
render: function() {
return this.transferPropsTo(<div style={{ border: "1px solid gray" }} className="button" />);
}
});
<Button style={{ background-color: "blue" }} className="blue-button" />
->

Keybase proof

I hereby claim:

  • I am joelburget on github.
  • I am joelb (https://keybase.io/joelb) on keybase.
  • I have a public key whose fingerprint is D13C 898E FCCD 6148 3204 86B8 19F0 8797 075F 8C88

To claim this, I am signing this object:

@joelburget
joelburget / gist:fdb1ba91ddf9f11fd303
Created February 28, 2015 22:23
nix / gnutar error
joel@dublin react-haskell (master) $ nix-env -i gnutar
installing ‘gnutar-1.27.1’
these derivations will be built:
/nix/store/1n01k44qqqzffi17c5cjw5gb41j2mdaa-hook.drv
/nix/store/khrfnv769klndplrcs0xncsxxamfldq0-perl-5.20.1.drv
/nix/store/23h5p8wix8w1p3fl08p0k4nlscmv8agr-coreutils-8.23.drv
/nix/store/mvjsycfh9g3c2xa8v86f0bh9jpnszfql-mirrors-list.drv
/nix/store/asw4d872wncdfvw3d9sladp3k0x75m4w-openssl-1.0.1l.drv
/nix/store/lhcf41ckdgn37vl76b6pz4g93kw2xyac-zlib-1.2.8.drv
/nix/store/bq7zrs2j4ggmvvmriwjhb4krhm1hv4qg-libssh2-1.4.3.drv
@joelburget
joelburget / gist:49f8906471fff1dcab6a
Created June 3, 2015 12:11
coping with changing programs

Setting the Stage

Starting from a dependently typed functional programming environment, I'll make a simplifying but nontrivial assumption - all program development is expressed as a series of changes. For example, if I start from some program f (x : X)(y : Y) = ?, then change the implementation to g (x : X)(y : Y) = ?, that change is known to the environment as "rename f to g", not "munge a character on line 1".

The entire course of program development, from the empty file, is changes like:

  • rename Bike to Bicycle
  • add a parameter to vehicles
  • define a new data type Airplane