Skip to content

Instantly share code, notes, and snippets.

🚀
Liftoff #fpvracing

Craig Derington craigderington

🚀
Liftoff #fpvracing
  • Craig Derington
Block or report user

Report or block craigderington

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@craigderington
craigderington / json_api_server.js
Created Jun 29, 2016
JSON API Server for NodeJS
View json_api_server.js
var http = require('http');
var url = require('url');
var portNumber = Number(process.argv[2]);
function parseTime(time) {
return {
hour: time.getHours(),
minute: time.getMinutes(),
second: time.getSeconds()
}
@craigderington
craigderington / forms.py
Created Jul 14, 2016
Customer List Filtered Table View Form Helper
View forms.py
class CustomerListFormHelper(FormHelper):
form_id = 'customer-search-form'
form_class = 'form-inline'
field_template = 'bootstrap3/layout/inline_field.html'
field_class = 'col-xs-3'
label_class = 'col-xs-3'
form_show_errors = True
help_text_inline = False
html5_required = True
layout = Layout(
View app.py
from flask import Flask
from flask import render_template, redirect, url_for, request, flash
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
import os
import requests
import json
import datetime
app = Flask(__name__)
View index.html
{% extends "layout.html" %}
{% block title %}
Reddit Reader | Public Timeline
{% endblock %}
{% block body %}
<h2><i class="fa fa-reddit-square"></i> Recent Reddits
<a style="margin-left:5px;" href="#menu-toggle" class="btn btn-default" id="menu-toggle"><i class="fa fa-toggle-left"></i> Toggle Menu</a>
@craigderington
craigderington / get-cta-bus-route.py
Last active Sep 26, 2016
CTA bus route tracking from Python Data Hacking
View get-cta-bus-route.py
#! /usr/bin/python
import time
import requests
import xml.etree.ElementTree as ET
my_latitude = 39.0548746
url = 'http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route='
route = str(input('Please select a bus route to view: '))
View named_tuples.py
import os
import collections
import random
import time
DataPoint = collections.namedtuple('DataPoint', 'id, x, y, temp, quality')
def main():
print('Creating dataset.')
data_list = []
View get_random_name.py
#! /usr/bin/python
import os
import re
import requests
from bs4 import BeautifulSoup
url = 'http://random-name-generator.info'
hdr = {
@craigderington
craigderington / models.py
Last active Nov 23, 2016
Solved: Django Tables2 and AJAX
View models.py
from django.contrib.auth.models import User
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
class Alert(models.Model):
SYSTEM_ALERT = 'system_alert'
View app.py
#! flask/bin/python
from flask import Flask, request, jsonify, abort, make_response, url_for
from flask_restful import Api, Resource, reqparse, fields, marshal
from flask_httpauth import HTTPBasicAuth
from datetime import datetime
import pyodbc
import json
import config
View models.py
class Item(TimeStampedModel):
LEADTIME_PERIOD = (
('D', 'DAYS'),
('W', 'WEEKS'),
('M', 'MONTHS'),
)
sku = models.CharField(max_length=50, blank=False, null=False)
item_name = models.CharField(max_length=50, blank=False, null=False)
item_description = models.TextField()
You can’t perform that action at this time.