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
""" | |
Fetches some valid oauth credentials from edX, using only the secret & app key. | |
Based primarly off of the Facebook example in flask-oauth | |
""" | |
from flask import Flask, redirect, url_for, session, request | |
from flask_oauth import OAuth | |
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
#!/bin/sh | |
# Originally from https://gist.github.com/dmkash/2355219 | |
SESSION_NAME="ccxcon" | |
cd ~/src/github.com/mitodl/ccxcon | |
tmux has-session -t ${SESSION_NAME} | |
if [ $? != 0 ] |
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
I really want a service where you can enter in 2 wikipedia pages and | |
it will tell you how they relate. It'd be especially cool if someone | |
else made it, so I'm writing up how I think it might be done in | |
Python. | |
Due to the nature of the queries you want to do (how does x relate to | |
y), I think this should end up in a graph database. In this graph | |
database, every page is a node. Links between pages are directed edges | |
in the graph, annotated with the paragraph of text they're linked | |
from. |
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
/* | |
goals: | |
middleware, like express. | |
no `.next()`, which express has. | |
use of promises (rejecting/resolving) unlike node's traditional (err, data) thing | |
immutable requests, preferring instead an explicit databag for state managment (continuous local storage) | |
"composable after the routing method" |
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
VENV_DIR=`md5sum requirements/* | md5sum 2>&1 | awk '{print $1}'` | |
if [ -e $VENV_DIR ]; then | |
. /tmp/$VENV_DIR/bin/activate | |
else | |
virtualenv --no-site-packages /tmp/$VENV_DIR | |
. /tmp/$VENV_DIR/bin/activate | |
pip install --download-cache /var/lib/jenkins/.pip_download_cache -r requirements/ci.txt | |
fi |
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/env node | |
/* | |
* We have trailing underscores on variables to indicate | |
* private. That's silly. Preceeding underscores are the only obvious | |
* choice. | |
* | |
* var foo = function () { | |
* this.bar_ = '9'; | |
* _.bindAll(this, 'foo_'); | |
* } |
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 lint = require('jsl') | |
, linter = lint(); | |
linter.rule('variable > id', | |
function (node, subsource, alert) { | |
var var_name = node.name; | |
if (var_name.indexOf("_") !== -1) { | |
alert(node, 'Found variable name with underscores: ' + var_name); | |
} | |
}, 'error'); |
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/env node | |
/** | |
* Transforms code from old-style requirejs modules into AMD sugared modules. | |
* | |
* define(['dep1','dep2'], function(arg1, arg2) {...}) | |
* | |
* becomes: | |
* | |
* define(function(require) { var arg1 = require('dep1'), arg2 = require('dep2'); ... }); | |
* |
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
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"fmt" | |
"html" | |
"log" | |
"net/http" | |
) |
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
class UserLog(object): | |
""" | |
Simple log that will output specially formatted user id for logging | |
purposes. | |
-1 is used as a sentinal value to mean "no user". Otherwise, the user's `pk` | |
attribute is logged instead. | |
An explicit decision was made not to use a LoggerAdapter with a custom | |
format string because if we attach it to something that isn't the logger |