Skip to content

Instantly share code, notes, and snippets.

View dtran320's full-sized avatar
🌊
Come co-work with us virtually! https://www.flow.club

David Tran dtran320

🌊
Come co-work with us virtually! https://www.flow.club
View GitHub Profile
@dtran320
dtran320 / overlay.html
Created May 13, 2011 07:45
Some CSS overlay stuff
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style>
.container1, .container2 {
width: 300px; height: 200px; float: left;
padding: 10px; margin-right: 10px; margin-bottom: 10px;
}
.container1 {
@dtran320
dtran320 / gist:1106059
Created July 26, 2011 05:45
Extract referrer domain name in javascript
function getReferrerDomain() {
var url = document.createElement('a');
url.href = document.referrer;
return url.hostname;
}
@dtran320
dtran320 / redis_session_backend.py
Created April 25, 2012 00:39 — forked from mikeyk/redis_session_backend.py
A redis backend for Django Sessions, tested on Django 1.3+
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
@dtran320
dtran320 / simple_redis_profile.rb
Created April 25, 2012 00:50 — forked from joeyAghion/simple_redis_profile.rb
By sampling keys from your redis databases, this script tries to identify what types of keys are occupying the most memory.
#!/usr/bin/env ruby
# Evaluates a sample of keys/values from each redis database, computing statistics for each key pattern:
# keys: number of keys matching the given pattern
# size: approximation of the associated memory occupied (based on size/length of value)
# percent: the proportion of this 'size' relative to the sample's total
#
# Copyright Weplay, Inc. 2010. Available for use under the MIT license.
#!/bin/bash
# Use apt-get to install necessary packages for installing from source
set -e
sudo apt-get install libncurses5-dev gcc g++ make
cd ~/
wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.36.tar.gz
tar -zxf mysql-5.1.36.tar.gz
@dtran320
dtran320 / startup.py
Last active December 20, 2016 20:42
startup.py
def build_startup(team, product, market, cash):
while team and cash > 0:
while not fits(product, market):
apply_breadth_first_search() # Apply with heuristics
apply_depth_first_search()
@dtran320
dtran320 / python_interview_setup.md
Created November 19, 2015 02:14
Crowdbooster Python Interview Setup Instructions

Thanks for taking time to interview with us! We have come up with a problem that we hope you will find fun and challenging and which will give us insight into the way you code and debug.

Please be prepared to share your screen during the call. On many computers, Skype screen sharing slows the computer down quite a bit, so make sure to close any unneeded programs. Rather than force you to write code on a whiteboard or in an unfamiliar web editor, we want you to be comfortable with your environment and have access to your usual preferred setup, code editor, debugging environment, and other tools. Pulling up documentation is totally fine as well.

Problem

When the call starts, you'll be linked to a Github repo containing the problem. To avoid any issues setting up your environment during the call, please do the following:

Requirements

@dtran320
dtran320 / circle.yml
Last active October 13, 2016 00:15
Yarn on CircleCI
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
override:
- yarn
post: # At least for me, it doesn't seem like `scripts` in `package.json` are being run, so you need to add them explicitly
- yarn run postinstall
@dtran320
dtran320 / Marathon Majors Qualifying Age Ranges.md
Last active November 18, 2018 22:28
Marathon Majors Qualifying Age Ranges
Marathon Range of Qualifying times for Men as you get older Range of Qualifying times for Women as you get older
New York 2 hours, 2 minutes (2:53 to 4:55) 3 hours, 23 minutes (3:13 to 6:35)
Chicago 2, 20 minutes hours (3:05 to 5:25) 2 hours, 35 minutes (3:35 to 6:10)
Boston 1 hour, 50 minutes (3:00 to 4:50) 1 hour, 50 minutes (3:30 to 5:20)
Berlin 40 minutes (2:45 to 3:25) 1 hour, 10 minutes (3:00 to 4:10)
@dtran320
dtran320 / Marathon Majors Qualifying Times for Women.md
Last active November 18, 2018 22:28
Marathon Majors Qualifying Times for Women