- Plain Strings (207):
foo
- Anchors (208):
k$
- Ranges (202):
^[a-f]*$
- Backrefs (201):
(...).*\1
- Abba (169):
^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
- A man, a plan (177):
^(.)[^p].*\1$
- Prime (286):
^(?!(..+)\1+$)
- Four (199):
(.)(.\1){3}
- Order (198):
^[^o].....?$
- Triples (507):
(^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
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
import unittest | |
class Lookahead(object): | |
def __init__(self, things, count): | |
self.things = tuple(things) | |
self.count = count | |
self.windows = len(things) - count + 1 | |
def __iter__(self): | |
return (self.things[i:i+self.count] for i in range(self.windows)) |
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 python3 | |
import unittest | |
"""Valid passwords | |
- are between 8 and 20 characters long | |
- contain at least one number | |
- have at least one uppercase and one lowercase character | |
- have a special char of !"§$%&/()=? | |
""" |
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
This just got linked to by the Y combinator news account, without proper context, | |
so a brief introduction: A month ago (end of May / early June 2014) I had a | |
Twitter conversation with a bunch of acquaintances. One tweet in the middle | |
of that thread, with obligatory hyperbole, was me saying that I think VR is | |
bad news. | |
Well, that part of the thread (but not the rest that provides context) recently | |
got retweeted, and then someone asked me if I could explain what I mean by that, | |
and because Twitter is a great platform for delivering 140 character slogans and | |
not so great for lengthy explanations, I wrote this. So, obligatory disclaimer: |
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
(defparameter *is-logged-in* nil) | |
(defparameter *users* '((golo secret) | |
(jones anothersecret))) | |
(defun user-by-login (login) | |
(assoc login *users*)) | |
(defun password-of (user) | |
(cadr user)) |
Here I'm trying to understand what happens when I run
./hello
#include
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 python | |
# License: http://creativecommons.org/publicdomain/zero/1.0/ | |
# See http://preshing.com/20130115/view-your-filesystem-history-using-python | |
import optparse | |
import os | |
import fnmatch | |
import time | |
# Parse options | |
parser = optparse.OptionParser(usage='Usage: %prog [options] path [path2 ...]') |
Since this is on Hacker News and reddit...
- No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
- I apologize for the use of
_t
in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries". - Since people kept complaining, I've fixed the assignments of string literals to non-const
char *
s. - My use of
type * name
, however, is entirely intentional. - If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |