Skip to content

Instantly share code, notes, and snippets.

View aguestuser's full-sized avatar

Austin Guest aguestuser

View GitHub Profile
@aguestuser
aguestuser / controllers.rb
Last active August 29, 2015 14:06
Routine for batch shift reassignment with automated scheduling obstacle detection (and override) for BK Shift on Rails
# *********************
# *****CONTROLLERS*****
# *********************
# *************************************
# SHIFTS CONTROLLER
# app/controllers/shifts_controller.rb
# *************************************
def batch_edit
@aguestuser
aguestuser / gist:b0430275cb61ac1a4066
Created February 25, 2015 03:07
recursive loop (with pdfs)
var arr = [1,2,3,4];
function dumbAddOne(arr) {
if (arr == []) return [];
else return ([1 + arr[0]]) + dumbAddOne(arr.slice(1));
}
function findActivty(pdfArr){
if (pdfArr == []) return [];
if (/Activity/.test(pdfArr[0])) {
@aguestuser
aguestuser / riddle.scala
Last active August 29, 2015 14:16
type mystery
//Riddle me this...
//This compiles:
def plotGrowth[A,T[B] <: Seq[B]](l: T[A], fn: T[A] => T[A]): Boolean = {
val intervals = (0 to 50).map(_ * l.size / 50)
intervals map { i =>
val sub = l.take(i)
System.gc()
val start = System.nanoTime
var _ = require('underscore');
// getDupeList([Tweet]) -> { String : [Int] }
// runs in O(n+m) where n is # tweets, m is # dupes
function getDupeList(ts){
var tts =_.chain(ts)
.map(function(t,i){ return _.extend(t, { i: i });})
.groupBy(function(tt){ return tt.id_str;})
.value();
return _.chain(tts)
@aguestuser
aguestuser / dedupeTests.js
Created March 19, 2015 01:07
Home spun tests for FP deduping thing for Tim
var _ = require('underscore');
// getDupeList([Tweet]) -> { String : [Int] }
// runs in O(n+m) where n is # tweets, m is # dupes
function getDupeList(ts){
var tts =_.chain(ts)
.map(function(t,i){ return _.extend(t, { i: i });})
.groupBy(function(tt){ return tt.id_str;})
.value();
return _.chain(tts)
@aguestuser
aguestuser / construct.js
Last active August 29, 2015 14:18
crockford on constructors
// pseudo-classical v1
var Mammal = function(name){
this.name = name;
this.get_name = function(){
return this.name;
};
this.purr = function() {
return "purr"
};
@aguestuser
aguestuser / littlesis-centrality.py
Created April 26, 2015 23:44
Matthew's Script for Calculating Centrality among LS entities
import sys
import MySQLdb as my
import networkx as nx
import csv
from IPython import embed
db = my.connect(host='localhost', user='littlesis', passwd='midm681_beet', db='littlesis')
cur = db.cursor(my.cursors.DictCursor)
# all positions
@aguestuser
aguestuser / keybase.md
Created April 27, 2015 01:51
keybase.md

Keybase proof

I hereby claim:

  • I am aguestuser on github.
  • I am aguestuser (https://keybase.io/aguestuser) on keybase.
  • I have a public key whose fingerprint is 0995 5956 FCCE 9986 E81C C8FC E58B D15A 1D4E FD5B

To claim this, I am signing this object:

@aguestuser
aguestuser / ls_install.md
Created May 12, 2015 21:53
LS INSTALL NOTES

Installing LS

Download MySQL dump

  • not secure to hand this out

  • tables to be removed:

    • api_request
  • api_user

;;; init.el --- Prelude's configuration entry point.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://batsov.com/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.