Skip to content

Instantly share code, notes, and snippets.

View metrics.py
import time
import sys
import os
from flask import request
import statsd
statsd_host = os.getenv('STATSD_UDP_HOST', 'localhost')
statsd_port = os.getenv('STATSD_UDP_PORT', 8125)
c = statsd.StatsClient(statsd_host, statsd_port, prefix='testapp')
View app.py
#!/usr/bin/env python
from flask import Flask, Response
from metrics import setup_metrics
app = Flask(__name__)
setup_metrics(app)
@app.route('/test/')
View ShaftController.php
<?php
class ShaftContoller
{
protected $elevators = [];
public function addRequest($request)
{
if ($request->floor > 0) {
$upQueue->push($request);
@king724
king724 / gist:1964564
Created Mar 3, 2012
Find the dates of a repeating event
View gist:1964564
<?php
/**
* Find dates of repeating events between two dates
*/
function find_recurring_dates($start_date, $end_date, $repeat_days){
$start = new DateTime($start_date);
$end = new DateTime($end_date);
// Find the number of days inbetween