Skip to content

Instantly share code, notes, and snippets.

View lukegb's full-sized avatar
🦦
👖

Luke Granger-Brown lukegb

🦦
👖
View GitHub Profile
angular.module('mainApp', ['websocketBackend']).config(function($routeProvider) {
});
function NowPlayingCtrl($scope, Socket) {
var that = this;
$scope.state = 'stop';
Socket.on('playback_state_change', function(newState) {
@lukegb
lukegb / asasasas.py
Created July 17, 2012 18:48 — forked from anonymous/asasasas.py
pypyppypypypy
class Point:
''' Point class for representing and manipulating x,y coordinates. '''
def __init__(self, initX, initY):
'''Create a new point at the origin'''
self.x = initX
self.y = initY
p = Point(7, 6)
q = Point(8, 2)
@lukegb
lukegb / gist:5228290
Last active December 15, 2015 08:09
duggan's list of Yahoo Message AMIs
16:04:43 <duggan> N. Virginia: ami-2400984d
16:04:43 <duggan> Ireland: ami-d8d2d8ac
16:04:43 <duggan> Tokyo: ami-a361e1a2
16:04:43 <duggan> Singapore: ami-6e703c3c
16:04:43 <duggan> Sydney: ami-4e0e9f74
16:04:45 <duggan> Sao Paolo: ami-9d7aa180
16:04:48 <duggan> N. California: ami-94f6dbd1
16:04:50 <duggan> Oregon: ami-cf9206ff
NB: your username goes in the user data field
import socket
MUTED_GROUP = 8
UNMUTED_GROUP = 7
WHO_UID = 'uaec6gN9PL9qwP5y1NGGW3D95VA='
#WHO_UID = 'BaP5bZRXx7OP59qJojvvHHxvx0w='
HOST = '127.0.0.1'
PORT = 25639
def wait_for_ok(s):

Keybase proof

I hereby claim:

  • I am lukegb on github.
  • I am lukegb (https://keybase.io/lukegb) on keybase.
  • I have a public key whose fingerprint is A600 0237 AD44 EEA9 1EA7 A39D 0F53 FD27 EEAA 9331

To claim this, I am signing this object:

app.directive('loginField', function($timeout) {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ctrl) {
ctrl.$validators.loginform = function(modelValue, viewValue) {
return true;
};
$timeout(function() {
ctrl.$setTouched();
ctrl.$validate();
@lukegb
lukegb / markdown.py
Last active January 12, 2016 17:20
I'm sorry...
import json
from django.contrib.staticfiles import finders
import execjs
ctx = None
def load_mdit():
global ctx
if ctx:
@lukegb
lukegb / dukpy.py
Created January 13, 2016 04:19
I went a little overboard
import django
django.setup()
from dukpy import Context
from ore.projects.models import Project
ctx = Context()
ctx.define_global_obj("Project", Project)
ctx.define_global_func("get_first_project_for_namespace", lambda name: Project.objects.filter(namespace__name=name).first())
@lukegb
lukegb / react.py
Created January 15, 2016 16:47
Calling React from Python? Certainly!
import dukpy
ctx = dukpy.RequirableContext(['/homes/leg13/test/node_modules'])
ret = ctx.evaljs("""
var React = require('react');
var HelloWorld = React.createClass({
render: function() {
return React.createElement('p', null, 'Hi!');
}
[lukegb@auth ~]$ sudo ls /proc/$(pgrep java)/fd | wc -l; curl -I https://auth.spongepowered.org/avatars/lol768 >/dev/null; sudo ls /proc/$(pgrep java)/fd | wc -l
1181
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 47904 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1183
[lukegb@auth ~]$ sudo ls /proc/$(pgrep java)/fd | wc -l; curl -I https://auth.spongepowered.org/avatars/lol768 >/dev/null; sudo ls /proc/$(pgrep java)/fd | wc -l
1183
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed