This file contains hidden or 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 hashlib | |
import hmac | |
import json | |
import urllib | |
import urllib2 | |
import uuid | |
SECRET = "This is a value which should be unique to the service." |
This file contains hidden or 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
.diff-line.line { | |
position: relative; | |
} | |
.diff-line:not(.gc).line::before { | |
-webkit-user-select:none; | |
pointer-events:none; | |
left: 10px; | |
color: transparent; | |
content: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | |
border-right: 1px dotted rgba(0, 0, 0, 0.5); |
This file contains hidden or 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 argv = ['damper.js', '--host', '0.0.0.0', '--port', '8675']; | |
var opts = argv.slice(1); | |
function options(opts, defaults) { | |
var out = defaults || {}, last; | |
for(var i = 0; i < opts.length; i++) { | |
var is_flag = opts[i].substr(0, 1) === '-'; | |
if (is_flag && last) { | |
out[last] = true; | |
} else if (!is_flag && last) { |
This file contains hidden or 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 log_gen(n): | |
import math | |
y = 1 | |
while y < n: | |
adder = max(1, 10 ^^ int(math.log10(y))) | |
yield int(y) | |
y += adder |
This file contains hidden or 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 reduce(a, b): | |
return "%s\n%s" % (a, b) |
This file contains hidden or 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 irc = require('irc'); | |
var client = new irc.Client('irc.mozilla.org', 'hugbot', { | |
channels: ['#amo', '#webdev', '#interns'], | |
}); | |
huggable = {}; | |
hugdelay = {}; | |
function contains(message, list) { | |
for(var i=0;i<list.length;i++) { |
This file contains hidden or 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 gen(data): | |
def g(): | |
for token in data.split(" "): | |
yield token | |
return g().next | |
defs = {"+": lambda x, y: x + y, | |
"-": lambda x, y: x - y, | |
"*": lambda x, y: x * y, |
This file contains hidden or 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 quantumify(evaluator, answers): | |
quantum_value = evaluator() | |
if any(map(lambda a: a in quantum_value, answers)): | |
pass | |
return "BOTH" |
This file contains hidden or 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
Public Class frmDvd | |
Private myParent As frmMain | |
Private Sub frmCustomer_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated | |
Dim idx As Integer | |
Dim panel As ToolStripStatusLabel | |
idx = myParent.searchForPanel("DVDs") | |
If idx <> -1 Then |
This file contains hidden or 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 completion(board): | |
"Returns a score of how far the board is from completion" | |
total = 0 | |
for pos in range(9): | |
i, j = pos // 3, pos % 3 | |
val = board[i][j] - 1 | |
if val < 0: continue | |
v1, v2 = val % 3 - j, val / 3 - i | |
total += (v1 if v1 > 0 else -1 * v1) + (v2 if v2 > 0 else -1 * v2) | |
return total |