Skip to content

Instantly share code, notes, and snippets.

@thisiswei
thisiswei / scrabble_play.py
Last active December 19, 2015 02:49
these codingbat from peter remind me CS212.
"""
In a series of exercises we will develop a program to find the highest-scoring
play on a Scrabble board. But we'll get there in small steps. In this exercise,
we will decide if it is legal to play a given word at a given start position on
a Scrabble board. To make things easier, in these first few exercises, the
board will consist of a single row, which will be represented as a list: a 1
indicates a blank square (later we will add 2, 3, etc. for double-and triple
letter scores), a '*' marks the start square at the center of the board, and a
capital letter indicates a letter already on the bjoard. Write
scrabble_legal_play(row, k, word) to return True if it is legal to play the
import webapp2
import jinja2
import os
import sys
import random
sys.path.insert(0, 'libs')
import re
import time
import jinja2
@thisiswei
thisiswei / stylr.py
Last active December 19, 2015 09:09
import webapp2
import jinja2
import os
import sys
import random
sys.path.insert(0, 'libs')
import re
import time
import jinja2
import Image
def create_thumbnail(old_path, new_path):
img = Image.open(old_path)
img.thumbnail((200, 200), Image.ANTIALIAS)
img.save(new_path)
@thisiswei
thisiswei / create_thumbnail.py
Last active December 21, 2015 18:09
create thumbnails
import re
import logging
import Image
from StringIO import StringIO
MAX_THUMBNAIL_WIDTH = 320.
THUMBNAIL_DIR = 'thumbnails'
IMG_REG_URL = re.compile(r'"(http://s7.jcrew.com/is/image/.*?)\"')
JCREW_URL = 'http://www.jcrew.com/womens_category/shoes.jsp?iNextCategory=-1'
def append(val, p):
last = p[-1]
p[-1] = val
insert(-1, last, p)
def insert(idx, val, iterable):
tmp = None
if idx < 0:
idx = len(iterable) + idx
for j, item in enumerate(iterable):
#include <stdio.h>
#include <stdlib.h>
char* CensorString1(char t[], char r[]) {
char *newT;
int i, j, k, occured;
i = j = k = 0;
for (i = 0; t[i] != '\0'; i++){
occured = 0;
for (j = 0; r[j] != '\0'; j++) {
class Node(object):
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __str__(self):
s = ''
if self.left is not None:
s += str(self.left)
@thisiswei
thisiswei / richhickey.md
Last active August 29, 2015 14:27 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following: