Skip to content

Instantly share code, notes, and snippets.

View rmaceissoft's full-sized avatar

Reiner Marquez rmaceissoft

View GitHub Profile
@rmaceissoft
rmaceissoft / gist:7212a82149efe7518ce0a378cb2cc6e3
Created August 27, 2018 21:25
OTPClient is a python class to make requests to the OTP API and process the response according to our needs from the server side:
import math
import re
import time
from django.conf import settings
import requests
# used to remove stop id from stop names included into pattern description
regex_stop_id = re.compile('(\(\w+:\d+\))')
@rmaceissoft
rmaceissoft / gist:ba5be255be4a3adfee7116651fafd039
Created August 27, 2018 21:25
OTPClient is a python class to make requests to the OTP API and process the response according to our needs:
import math
import re
import time
from django.conf import settings
import requests
# used to remove stop id from stop names included into pattern description
regex_stop_id = re.compile('(\(\w+:\d+\))')
HASTUS_ID, Station title ////// Title of GTFS Stop linked
15432 Canoga Station ///////// Canoga Station
5030 Figueroa Wy/Adams ///////// Figueroa / Adams
5019 Figueroa/7th ///////// Figueroa / 7th
13489 Flower/7th ///////// Flower / 7th
80123 23rd St Station ///////// LATTC / Ortho Institute Station
1813 Flower/23rd ///////// Flower / 23rd
80127 Expo/Western Station ///////// Expo / Western Station
15535 Sepulveda Station ///////// Sepulveda Station
5040 Figueroa/Olympic ///////// Figueroa / Olympic
@rmaceissoft
rmaceissoft / engine.md
Last active August 11, 2016 16:58 — forked from douglasgoodwin/engine.md
What's under the hood?

What's under the hood?

(in progress)

  1. GTFS Schedule data
  2. Open Trip Planner
  3. Application Programming Interfaces (APIs)
  4. Mapbox map tiles
  5. Database
  6. Backend framework
'use strict';
// Load Dependencies
var $ = require('jquery');
require('jquery-guillotine');
var angular = require('angular');
var _ = require('lodash');
var app = angular.module('pageApp', []);
/*global module, require, console*/
/*jslint nomen: false*/
var properties = {
// global properties go here
appName: "tidalwavez",
logs : {
folder : './log',
@rmaceissoft
rmaceissoft / gist:8109206
Created December 24, 2013 05:40
angularjs service to handle login/logout/status
define(function(require, exports, module) {
var angular = require('angular');
require('angular-cookies');
var usersModule = module.exports = angular.module('users', ['ngCookies'])
.factory('UserService', ['$http', '$cookieStore', function($http, $cookieStore) {
var currentUser = $cookieStore.get('user') || null;
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
/* --------------------------------------- */
/* --( Variables )-- */
/* --------------------------------------- */
@rmaceissoft
rmaceissoft / fields.py
Created April 1, 2013 16:28
custom tastypie resource field to deserialize thumbnails generated with sorl-thumbnail
from tastypie.fields import DictField
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.helpers import ThumbnailError
class SorlThumbnailField(DictField):
"""
api field used to return a thumbnail generated with
sorl-thumbnail python library
@rmaceissoft
rmaceissoft / gist:3452971
Created August 24, 2012 17:08
generating unique id from datetime field in order to implement infinite scroll
import time
from django.db import models
class MyModel(models.Model):
# other fields...
start_date = models.DateTimeField()
unique_date = models.CharField(max_length=32, unique=True)