Skip to content

Instantly share code, notes, and snippets.

View gsmcwhirter's full-sized avatar

Gregory McWhirter gsmcwhirter

View GitHub Profile
@gsmcwhirter
gsmcwhirter / aliases.py
Created July 5, 2017 17:11 — forked from sampsyo/aliases.py
hack for argparse adding subcommand aliases
#!/usr/bin/env python
"""Aliases for argparse positional arguments."""
import argparse
class AliasedSubParsersAction(argparse._SubParsersAction):
class _AliasedPseudoAction(argparse.Action):
def __init__(self, name, aliases, help):
window.App = Ember.Application.create({});
document.title = "Olp Contracting";
// Routes
App.Router = {
project_index: function (){
document.title = "Projects";
var theview = App.ProjectView.create();
theview.append();
window.App = Ember.Application.create({});
document.title = "Olp Contracting";
// Routes
App.Router = {
project_index: function (){
document.title = "Projects";
App.ProjectView.append();
},
<?php
$query = "SELECT mapid, kills, games, kills/games as kpg, connections, connections/games as cpg FROM ps_c_map_data ORDER BY kpg IS NOT NULL DESC, kpg DESC, games desc";
$result = mysql_query($query)
or die('Sorry, we could not retrieve pending from the database. Please try again.');
$totalmaps = mysql_num_rows($result);
while ($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$mapid = $row['mapid'];
$kills = (int)$row['kills'];
$games = (int)$row['games'];
<?php
$query = "SELECT mapid, kills, games, connections FROM ps_c_map_data ORDER BY games desc";
$result = mysql_query($query)
or die('Sorry, we could not retrieve pending from the database. Please try again.');
$totalmaps = mysql_num_rows($result);
$mapdata = array();
$kpgdata = array();
while ($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$mapdata[$row['mapid']] = array();
<?php
function scheduleLinkGetScheduleId($id = false) {
$query = "
SELECT
schedule_id
FROM
schedule_links
WHERE
deleted = 0
<?php
$qry_str = 'publisher=9284102052512106';
$url = "http://api.indeed.com/ads/apisearch?". $qry_str . '&q=' . $_GET['q'] . '&l=' . $_GET['l'];
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return into a variable
//curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
//curl_setopt($ch, CURLOPT_POST, true); // set POST method