Skip to content

Instantly share code, notes, and snippets.

@phirework
phirework / timestamp.html
Created September 4, 2013 20:39
Time-based progress bar in JS. See: http://phirework.com/code/timestamp.html
<html>
<head>
<title>Using JS to show a progress bar based on time elapsed between two points</title>
<script type="text/javascript">
// This is only here for illustration purposes. See comments below for how to create new start/end points
var randomStart = Math.random() * 24;
var randomEnd = Math.random() * 24;
function timeElapsed() {
@phirework
phirework / db.txt
Last active December 17, 2015 00:48
Look up values in a MySQL table using PHP/AJAX with two dropdown menus
+-------+----------+----------+----------+
| route | first | second | distance |
+-------+----------+----------+----------+
| 1 | London | Madrid | 3 |
| 2 | London | New York | 8 |
| 3 | London | Chicago | 7 |
| 4 | Madrid | New York | 9 |
| 5 | Madrid | Chicago | 6 |
| 6 | New York | Chicago | 5 |
+-------+----------+----------+----------+
@phirework
phirework / hs.py
Last active December 15, 2015 09:29
Here's a command-line game I wrote for my Hacker School app. (It's also my first independently-written Python script, hurray.)
from sys import exit
from collections import defaultdict
from random import randint
import time
# Create a list with 9 spaces in it
grid = []
for x in range(0, 9):
grid.append(' ')
@phirework
phirework / map.html
Created February 12, 2013 18:16
Create a Google map using JSON data with check-box filtering for categories. Map data set-up: name, url, place (address), ltt (latitude), lgt (longitude), cat (category). Set up custom icons that correspond to the name of each category in PNG format. Sample: http://dev.phirephoenix.com/map/maps.html
<div id="map" style="width: 550px; height: 450px"></div>
<form action="#">
Eat: <input type="checkbox" id="eatbox" onclick="boxclick(this,'eat')" /> &nbsp;&nbsp;
Stay: <input type="checkbox" id="staybox" onclick="boxclick(this,'stay')" /> &nbsp;&nbsp;
Shop: <input type="checkbox" id="shopbox" onclick="boxclick(this,'shop')" />&nbsp;&nbsp;
Play: <input type="checkbox" id="playbox" onclick="boxclick(this,'play')" />&nbsp;&nbsp;
Community: <input type="checkbox" id="communitybox" onclick="boxclick(this,'community')" /><br />
</form>