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
<?php //this is a snippet from ./system/core/CodeIgniter.php | |
/* | |
* ------------------------------------------------------ | |
* Is there a pre-filter on the requested method? | |
* ------------------------------------------------------ | |
*/ | |
if (isset($CI->pre_filter) && is_array($CI->pre_filter)) | |
{ | |
foreach ($CI->pre_filter as $pre_filter_action => $filtered_action) |
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
<?php | |
/** | |
* Return a "human-readable" time such as 8 hours ago. | |
* | |
* @author Dan O'Connor, Modified by Ethan Taubman | |
* | |
* @param string $time such as: 2013-03-18 21:13:59 | |
* @param string $format optional such as: "<em>%d</em> %s%s since last post." | |
* |
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
<?php | |
/** | |
* Utility file to pull Citibike Station Data and write to a log file | |
* get_data.php | |
*/ | |
function get_data () { | |
$href = "http://citibikenyc.com/stations/json"; | |
$json = file_get_contents($href); | |
return $json; |
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
<?php | |
/** | |
* Utility file for turning my JSON log files into usable data | |
* parse_log_files.php | |
*/ | |
$start_time = time(); | |
date_default_timezone_set("America/New_York"); | |
function write_file ($contents, $name) | |
{ |
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
function shortenNumber(n, d) { | |
if (n < 1) return "<1"; | |
var k = n = Math.floor(n); | |
if (n < 1000) return (n.toString().split("."))[0]; | |
if (d !== 0) d = d || 1; | |
function shorten(a, b, c) { | |
var d = a.toString().split("."); | |
if (!d[1] || b === 0) { | |
return d[0] + c |
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 random | |
from time import time | |
class OpenDoorsOutOfRangeError(Exception): | |
def __init__(self): | |
pass | |
class Monty: | |
initial = False |
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 csv | |
import time | |
import datetime as dt | |
import re | |
files = ["data/2013-7.csv","data/2013-8.csv","data/2013-9.csv","data/2013-10.csv","data/2013-11.csv", "data/2013-12.csv","data/2014-1.csv", "data/2014-2.csv"] | |
def convert_to_timestamp(time_string): | |
month = re.search("\d+",time_string).group(0) | |
if len(month) == 1: month = "0" + str(month) |
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
Public Const DEVELOPMENT_MODE As Boolean = True | |
Public Sub Assert(ByRef bConditional As Boolean, _ | |
Optional ByRef TestName As String) | |
If DEVELOPMENT_MODE Then | |
Debug.Print bConditional, TestName | |
End If | |
End Sub |
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 pandas as pd | |
import json | |
from bs4 import BeautifulSoup | |
import requests | |
URL = "http://home.trainingpeaks.com/athlete/workout/UzpDb" | |
file_contents = requests.get(URL).text | |
soup = BeautifulSoup(file_contents,'html.parser') |