Skip to content

Instantly share code, notes, and snippets.

.directive('sides', function() {
// not working
return {
scope: {
sides: [
{ Name: 'Buy', Id: 1 },
{ Name: 'Sell', Id: -1 }
]
},
restrict: 'A',
.directive('sides', function () {
return {
// this seems to solve the problem - don't use link, use a built in controller.
controller: function ($scope) {//, elem, attrs) {
$scope.sides = [
{ Name: 'Buy', Id: 1 },
{ Name: 'Sell', Id: -1 }
];
$scope.side = $scope.sides[0];
},
@derwolfe
derwolfe / gist:7714874
Created November 30, 2013 03:02
raw header returned
[('Date', ['Sat, 30 Nov 2013 03:01:37 GMT']),
('Last-Modified', ['Sat, 30 Nov 2013 03:01:37 GMT']),
('Accept-Ranges', ['bytes']),
('Content-Type', ['text/plain']),
('Server', ['TwistedWeb/13.1.0'])]
@derwolfe
derwolfe / make
Last active August 29, 2015 13:55
makefile with test, build, clean etc. Not excellent make, but works.
# you should put all of the tests to be run for each of the
# files as they are being built
CC=rustc
BUILDDIR=~/Code/matasano/rust/build
DOCDIR=~/Code/matasano/rust/docs
CCFLAGS=--out-dir $(BUILDDIR)
DC=rustdoc --output $(DOCDIR)
all: score single_cipher decrypt_single fixed_xor encode64
@derwolfe
derwolfe / new output with verbose
Last active August 29, 2015 13:57
gdb/rust symbols
(gdb) set verbose
(gdb) b main
Breakpoint 1 at 0x100000e70
(gdb) r foo.rs --out-dir ./bar/baz
Starting program: /Users/chris/Code/rust/x86_64-apple-darwin/stage1/bin/rustc foo.rs --out-dir ./bar/baz
warning: platform-specific solib_create_inferior_hook did not load initial shared libraries.
# this is on os x
@derwolfe
derwolfe / longrunning.py
Last active August 29, 2015 14:02
example of long running task with intermediate status result
# XXX many of the addBoths should be changed to involve error handling
"""
longrunning
This is an example of how one can develop a system using twisted.web
that can process long running results but still provide a short
request-response cycle.
This implements the following pattern:
1) request received by twisted application
from twisted.internet import reactor
from twisted.web import server, resource
from autobahn.wamp1.protocol import WampClientFactory, WampCraClientProtocol
from autobahn.twisted.websocket import connectWS
class SomeClient(WampCraClientProtocol):
def doSomething(self, something):
return something
@derwolfe
derwolfe / gist:ca5f7e86790e1c2df6ca
Created November 20, 2014 16:41
irc notes about twisted packaging/docs - ticket #3696
09:41 <herrwolfe45> I'm working on ticket #3696 and am a bit stuck on what type of documentation I should write - I'm thinking I should write a how-to describing how one should install twisted and it's various optional dependencies. This how-to would be in the narrative docs for twisted core. Does this sound like a decent idea?
09:41 <glyph> herrwolfe45: That sounds fantastic.
09:42 <herrwolfe45> glyph: excellent, I'll start with that - thanks
09:45 <herrwolfe45> ergh its
09:48 <exarkun> When writing that, don't forget that `pip install Twisted` is the least preferred installation method. When possible people should prefer an OS-supplied package. (But it's certainly not always possible.)
09:49 <exarkun> (Or possibly tailoring different sections of the document to different audiences makes sense - developers working on Twisted have slightly different requirements from developers using Twisted have very different requirements from end-users using an application that depends on Twisted.)
09:50 <glyph> exarkun:
# File: data_handlers.py
from models import MyDataObject
class MyDataHandler:
""" responsible for working on the data only."""
def __init__(self, data_object):
self.data_object = data_object
def mult_data_by_two(self):
return self.data_object.numeric_data * 2
@derwolfe
derwolfe / irclog.txt
Created December 31, 2014 17:15
irclog
12:06 <herrwolfe> is there a configuration option to specify a tox environment to only run on osx? I'm bundling an application and would like go through the long process of getting pyobjc installed, but only when actually necessary
12:11 → Ivo and avanderneut1 joined ⇐ jaraco, Jurko, antocuni, cr3 and avanderneut quit ↔ wirrrbel, maryokhin, dowwie and wirrrbel1 popped in
Wednesday, December 31st, 2014
02:03 → jaraco, wirrrbel and cr3 joined ↔ antocuni and Jurko popped in ↔ bubenkoff and untitaker nipped out
09:30 <ronny> herrwolfe: im not aware of a easy way to do that right now
09:33 ⇐ wirrrbel quit ([email protected]) Ping timeout: 264 seconds
09:53 <herrwolfe> ronny: thanks - it seems like that is something I should probably handle at a different level anway
10:06 ↔ pf_moore nipped out
10:07 <ronny> herrwolfe: as faras i can tell, platform tags for tox might be a good idea
10:07 <ronny> (solutions on other levels seem uneasonably complex at first thou