Skip to content

Instantly share code, notes, and snippets.

View joshalbrecht's full-sized avatar

Josh Albrecht joshalbrecht

  • Sourceress
  • San Francisco
View GitHub Profile

Example 0

import torch


def computePower(waveform):
    return torch.sum(torch.absolute(waveform) ** 2)
@joshalbrecht
joshalbrecht / gist:8836208
Created February 6, 2014 00:29
Teaching kans about DI
/* It's exceedingly rare that there is ever a single instance (when you consider testing as well).
* If there REALLY is just a single instance, it can just be a static member in some globals class, ex:
*/
public final class Globals {
//set me as soon as possible while initializing the application I guess
public static State state;
}
/* The way it would ideally would work with dependency injection is that each class that actually
@joshalbrecht
joshalbrecht / aop.xml
Created September 12, 2013 07:15
Can't get this to show up on stackoverflow for whatever reason.
<aspectj>
<aspects>
<aspect name="com.yourcompany.yourpackage.MethodLogger"/>
</aspects>
<weaver options="-XnoInline">
<!--Note: the two .. are really important -->
<include within="com.yourcompany..*"/>
</weaver>
</aspectj>