Skip to content

Instantly share code, notes, and snippets.

@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>
@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 / 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 / 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 / .gitconfig
Last active November 13, 2019 21:37
Default git config file
[alias]
co = checkout
cb = checkout -b
br = branch
st = status
cp = cherry-pick
rs = reset --hard HEAD
vh = log --invert-grep --committer="AUTHOR\\ NAME" --pretty=format:"%C(yellow)%h\\ %C(magenta)%ad\\ %C(cyan)%<|(35)%cn\\ %Cred%d\\ %Creset%s" --decorate --date=short -20
hist = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short -20
histq = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short -n
@phirework
phirework / Notes for local Drupal setup
Created January 13, 2014 22:32
Setting up local Drupal install with nginx and drush
# Install drush by unzipping drush in home directory
# https://drupal.org/node/1674222
# Add this to your .bash_profile
alias drush="DRUSH_DIRECTORY/drush.php"
# Set error reporting (navigate to drupal home directory)
drush vset error_level 2 --yes
# Create user, assigining privileges
create user 'USER'@'localhost' identified by 'PASSWORD'
@phirework
phirework / settings.php
Created January 13, 2014 22:35
Drupal settings.php
// Add this to bottom of default settings.php file
error_reporting(E_ALL & ~E_STRICT);
ini_set('memory_limit', '1024M');
set_time_limit(120);
@phirework
phirework / nginx config
Created January 13, 2014 22:40
nginx configuration for virtual sites
# If you installed nginx with homebrew, go to /usr/local/etc/nginx, and create these directories:
mkdir sites-available
mkdir sites-enabled
# Add the following to nginx.conf before the final }
include /usr/local/etc/nginx/sites-enabled/*;
# Put your virtual host config files in ./sites-available and symlink as necessary
ln -s /sites-available/custom.conf /sites-enabled/custom.conf
@phirework
phirework / gist:19c2c633e42cd3930418
Created September 3, 2014 21:40
Graphite deployment steps
=== PREP
1. Make sure everyone has their work merged into QA
2. Make sure no one is using the QA server
=== DRY RUN PROCEDURE
1. Git steps
a. git checkout prod_currentversion (eg. prod_v2.5)
b. git pull origin
c. git branch prod_currentrelease (eg. prod_v2.6)

Keybase proof

I hereby claim:

  • I am phirework on github.
  • I am phirework (https://keybase.io/phirework) on keybase.
  • I have a public key ASDwopnmhkZ4DkUHwgBaoIbV4XviH0HHWGyNumLZ_thNZAo

To claim this, I am signing this object: