Skip to content

Instantly share code, notes, and snippets.

View alex-laties's full-sized avatar

Alexander Laties alex-laties

  • Google
  • New York, New York
View GitHub Profile
@alex-laties
alex-laties / SoundAnalyzer.cpp
Created January 20, 2012 22:19
implementation
//
// SoundAnalyzer.cpp
// BadTouchCLI
//
// Created by Alex Laties on 1/20/12.
// Copyright (c) 2012 University of Pennsylvania. All rights reserved.
//
#include "SoundAnalyzer.h"
void SoundAnalyzer::ProcessPacket(<#AudioQueueBufferRef buf#>) {
@alex-laties
alex-laties / gist:1735434
Created February 4, 2012 04:53
Error log for current Konsole MacPort package (konsole 4.8.0)
:info:configure -- Found Qt-Version 4.7.4
:info:configure -- -> QT_QMAKE_EXECUTABLE is /opt/local/bin/qmake
:info:configure -- -> QT_INCLUDE_DIR is /opt/local/include
:info:configure -- -> QT_QTCORE_INCLUDE_DIR is /opt/local/include/QtCore
:info:configure -- -> QT_BINARY_DIR is /opt/local/bin
:info:configure -- -> QT_LIBRARY_DIR is /opt/local/lib
:info:configure -- -> QT_PLUGINS_DIR is /opt/local/share/qt4/plugins
:info:configure -- -> QT_MKSPECS_DIR is /opt/local/share/qt4/mkspecs
:info:configure -- Phonon Version: 4.4.2
:info:configure -- Found KDE 4.7 include dir: /opt/local/include
<div class="modal-body">
<form class="form-search" id="search">
<input text="text" class="input-large search-query">
<a href="#" class="btn btn-primary">Search</a>
<div class="hidden-submit">
<input type="submit" tabindex="-1">
</div>
</form>
</div>
/Users/ag/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/attribute_methods/write.rb:14: syntax error, unexpected '?', expecting ';' or '\n'
def is_professor?=(new_value); write_attribute...
^
/Users/ag/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/attribute_methods/write.rb:14: syntax error, unexpected keyword_end, expecting $end
...is_professor?', new_value); end
font:
family: serif
weight: bold
size: 1.2em
@alex-laties
alex-laties / djangosession.py
Created December 17, 2012 03:06
Accessing django sessions via a WSGI Middleware. Can be used in any python web stack that conforms to the PEP 333 WSGI specification. This includes bottle.
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' #not using env.put as that does not execute immediately
from django.conf import settings
SessionStore = __import__(settings.SESSION_ENGINE, fromlist=['']).SessionStore
class DjangoSessionWSGIMiddleware(object):
transform = false #doesn't transform output of anything above in the stack
def __init__(self, app):
self.app = app
import urllib2
import json
from supervisor import childutils
import sys
import socket
class PagerDutyNotifier(object):
def __init__(self, pd_service_key):
self.pd_service_key = pd_service_key
def decode_byte(b):
b = ord(b)
b = chr(((b & 3) << 6) + (b >> 2))
return b
javascript:(function()%7Bfunction%20c()%7Bvar%20e%3Ddocument.createElement(%22link%22)%3Be.setAttribute(%22type%22,%22text/css%22)%3Be.setAttribute(%22rel%22,%22stylesheet%22)%3Be.setAttribute(%22href%22,f)%3Be.setAttribute(%22class%22,l)%3Bdocument.body.appendChild(e)%7Dfunction%20h()%7Bvar%20e%3Ddocument.getElementsByClassName(l)%3Bfor(var%20t%3D0%3Bt%3Ce.length%3Bt%2B%2B)%7Bdocument.body.removeChild(e%5Bt%5D)%7D%7Dfunction%20p()%7Bvar%20e%3Ddocument.createElement(%22div%22)%3Be.setAttribute(%22class%22,a)%3Bdocument.body.appendChild(e)%3BsetTimeout(function()%7Bdocument.body.removeChild(e)%7D,100)%7Dfunction%20d(e)%7Breturn%7Bheight:e.offsetHeight,width:e.offsetWidth%7D%7Dfunction%20v(i)%7Bvar%20s%3Dd(i)%3Breturn%20s.height%3Ee%26%26s.height%3Cn%26%26s.width%3Et%26%26s.width%3Cr%7Dfunction%20m(e)%7Bvar%20t%3De%3Bvar%20n%3D0%3Bwhile(!!t)%7Bn%2B%3Dt.offsetTop%3Bt%3Dt.offsetParent%7Dreturn%20n%7Dfunction%20g()%7Bvar%20e%3Ddocument.documentElement%3Bif(!!window.innerWidth)%7Breturn%20window.innerHeight%7Delse%
#!/bin/bash
# Sets paths and runs gulp
# Assumes node is already installed and you run this script from the top level of the repo
ORIGINAL_NODE_PATH=`echo $NODE_PATH`
CURR_DIR=`pwd`
export NODE_PATH=$NODE_PATH:$CURR_DIR/node_modules
$CURR_DIR/node_modules/gulp/bin/gulp.js
export NODE_PATH=$ORIGINAL_NODE_PATH