Skip to content

Instantly share code, notes, and snippets.

View redspider's full-sized avatar

Richard Clark redspider

  • Red Spider Limited
  • Wellington, New Zealand
View GitHub Profile
"""
If you choose an answer to this question at random,
what is the chance you will be correct?
A) 25%
B) 50%
C) 60%
D) 25%
"""

Keybase proof

I hereby claim:

  • I am redspider on github.
  • I am phirate (https://keybase.io/phirate) on keybase.
  • I have a public key whose fingerprint is 5786 1353 E629 C8DF 69E7 A591 F406 DFEC 48E9 ACFD

To claim this, I am signing this object:

@redspider
redspider / piss_me_off.txt
Created November 18, 2010 00:03
Things that have pissed me off about sendgrid so far
1. Pricing page does not actually say you're being charged per month. I assumed, but still.
2. Signup page asks for pointlessly unnecessary details. What do you care what my address is?
3. Signup page asks for a Username (in email format). What is that? WHAT IS THAT? HOW DID IT GET PAST YOUR UI QA?
4. After signing up, I received no less than 3 emails. A registration confirmation, an automatic payment notification, and a payment confirmation. Buried in one of these is a link I have to click to confirm my email address works, but nowhere on the dashboard does it say that (I clicked around on the dash for ages before I looked at my email)
5. When I clicked the link to confirm my email address works, the only message I got was "You have already logged in"
6. All the documentation is in a vanilla mediawiki. Seriously unprofessional.
7. The issues system is a third-party provider, that requires that I log in all over again. Tell me, how are you going to figure out which real account my twitter account relates to s
@redspider
redspider / model_session.php
Created December 7, 2010 05:12
Model session example rewrite
<?php
/* Model class for Sessions
A session represents an independent teaching segment. The following rules
definitely apply:
1. A session has one single owner, the expert.
2. A session has the following properties associated directly with it:
2.1. A title, indicating the topic of the segment.
2.2. A level rating, indicating the difficulty
word_count = dict()
word_file = open('text.txt',r)
for line in word_file:
for word in line.split(' '):
word_count[word] = word_count.get(word,0)+1
words = word_count.keys()
words.sort(lambda a,b: cmp(word_count[a],word_count[b]))
print words.join('\n')
#!/bin/bash
cd /my/virtual/env
./bin/activate
exec bin/python $*
var sys = require("sys");
var class = function () {
var V = 0;
var method = function (i) {
V+=i;
}
}
>>> import bcrypt
>>> password = "kitten"
>>> salt = bcrypt.gensalt()
>>> salt
'$2a$12$yqUmgo2jguH0dsoH5m6JWe'
>>> hashed = bcrypt.hashpw(password, salt)
>>> hashed
'$2a$12$yqUmgo2jguH0dsoH5m6JWeFYBfSqGjVQ26llCDhg/tYmpC14EUJyS'
>>> hashed[:29] == salt
True
@redspider
redspider / perf.js
Created January 14, 2011 02:13
Performance test for object creation
/**
* Performance test for object creation
*
* See: http://javascriptweblog.wordpress.com/2010/03/16/five-ways-to-create-objects/
*/
// 4. Simple constructor for new
var TInScope = function () {
this.test_prop = "4. Simple constructor for new";
def normalise(s):
s = s.replace(r'RT @[^ ]+','')
s = s.lower()
s = s.strip()
return md5(s).hexdigest()