Skip to content

Instantly share code, notes, and snippets.

View selahlynch's full-sized avatar

Selah Lynch selahlynch

View GitHub Profile
@selahlynch
selahlynch / gist:7536397
Created November 18, 2013 22:18
Rough description of our Data API from Forio Simulate
#Description of JSON object
{hires:[
{company:xxx1, employee:yyy1, salary:zzz1},
{company:xxx2, employee:yyy2, salary:zzz2},
{company:xxx3, employee:yyy3, salary:zzz3}
]}
to get the salary of employee#2
GET /hires/1/salary
@selahlynch
selahlynch / gist:7536421
Created November 18, 2013 22:20
Decision Directive Definition
angular.module('startup.directives.decision', [])
.directive('decisionMaker', ['simulatePushChannel', function (simulatePushChannel) {
return{
restrict: 'E',
templateUrl: 'views/directives/decision.html',
scope: {
runId:"=",
roles:"=",
founderName:"=",
@selahlynch
selahlynch / gist:7536443
Created November 18, 2013 22:22
directive pseudo code
var myModule = angular.module(...);
myModule.directive('namespaceDirectiveName', function factory(injectables) {
var directiveDefinitionObject = {
restrict: string,
priority: number,
template: string,
templateUrl: string,
replace: bool,
transclude: bool,
@selahlynch
selahlynch / gist:7536450
Created November 18, 2013 22:23
gameBoard controller definition
'use strict';
angular.module('simulateApp')
.controller('InstructorGameBoardCtrl', ['$scope', '$rootScope', 'NEWS', '$timeout', 'GameCharacter', 'Chat', 'gameBoardData', 'Data', 'players', '$location', 'DecisionsDataAnalyzer', 'Timer', 'GameStateManagement', '$route', function ($scope, $rootScope, NEWS, $timeout, GameCharacter, Chat, gameBoardData, Data, players, $location, DecisionsDataAnalyzer, Timer, GameStateManagement, $route) {
$rootScope._pageTitle = 'Gameboard';
var newsToMerge;
var newestFirst = function (a, b) {
return b.date - a.date;
@selahlynch
selahlynch / gist:7536472
Created November 18, 2013 22:25
immediate function example
var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
today = new Date(),
msg = 'Today is ' + days[today.getDay()] + ', ' + today.getDate();
alert(msg);
//////////////////////////////////////////////////////////////////
(function () {
@selahlynch
selahlynch / gist:7536483
Created November 18, 2013 22:25
instructor gameManagment view
<w-accordion>
<w-accordion-group ng-repeat="(founder, founderData) in founders" is-open="$first">
<w-accordion-heading>
<div class="pull-right">
<span class="label label-success">{{founderData.counts.investment}} Investor(s)</span>
<span class="label label-success">{{founderData.counts.hire}} Employee(s)</span>
</div>
<img ng-src="{{founderData.roleDesc.avatar}}"> {{founder}}
</w-accordion-heading>
@selahlynch
selahlynch / gist:7536502
Created November 18, 2013 22:27
timer code
Timer.prototype.start = function() {
var self = this;
(function countdown() {
if (self.count > 0) {
var m = Math.floor(self.count / 60);
var s = self.count % 60;
self.onTick(formatTime(m),formatTime(s));
self.count = self.count - 1;
$timeout(countdown, 1000);
}
@selahlynch
selahlynch / groupData-service-e2e.js
Created August 21, 2014 21:18
MacroSim - code for presentation
'use strict';
//make assumption that players S1-S6 exist
describe('Macrosim Homepage', function() {
beforeEach(function(){
//login to macrosim
browser.get('http://localhost:4444/simulate/lldev/macrosim/simulation/#/login');
@selahlynch
selahlynch / TwitterMySQL.py
Last active August 29, 2015 14:13
social media posts gathering
#! /usr/bin/python
__author__ = "Maarten Sap"
__email__ = "maartensap93@gmail.com"
__version__ = "0.3"
"""
TODOs:
pull retweeted message as well as original
import MySQLdb
import time
import sys
import logging
class MySQLdbSession:
def __init__(self, mysqldb_connect_params, max_reconnect_attempts=5, pause_between_attempts=1, is_ss=False):
self.mysqldb_connect_params = mysqldb_connect_params
self.reconnect_attempts = 0