Skip to content

Instantly share code, notes, and snippets.

View jpswain's full-sized avatar

Jamie Swain jpswain

  • Los Angeles, CA
View GitHub Profile
@mihow
mihow / load_dotenv.sh
Last active May 4, 2024 12:32
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@leandrob13
leandrob13 / SlickQueryOps.scala
Last active July 14, 2022 21:09
Trait that adds two functions to the slick Query type. I am using typelevel.cats as the functional library. Works for play-slick 3.1
trait SlickQueryOps {
databaseConfig: HasDatabaseConfig[ JdbcProfile ] =>
import cats.Apply
import cats.std.list._
import driver.api._
type BooleanOp = ( Rep[ Boolean ], Rep[ Boolean ] ) => Rep[ Boolean ]
implicit class OptionFilter[ X, Y ]( query: Query[ X, Y, Seq ] ) {
@tasdikrahman
tasdikrahman / python_tests_dir_structure.md
Last active February 21, 2024 02:16
Typical Directory structure for python tests

A Typical directory structure for running tests using unittest

Ref : stackoverflow

The best solution in my opinion is to use the unittest [command line interface][1] which will add the directory to the sys.path so you don't have to (done in the TestLoader class).

For example for a directory structure like this:

new_project

├── antigravity.py

@milessabin
milessabin / tuplegeneric.scala
Last active March 13, 2023 20:27
Convert (small enough) case classes to and from tuples using shapeless ...
import shapeless._
import ops.hlist.Tupler
trait TupleGeneric[C <: Product] extends Serializable {
type Repr <: Product
def to(t : C) : Repr
def from(r : Repr) : C
}
@gigiigig
gigiigig / auxpattern.scala
Last active November 11, 2023 05:22
Aux Pattern
import shapeless._
import scalaz._
import Scalaz._
object console extends App {
trait Foo[A] {
type B
def value: B
@platy
platy / ScheduledExecutor.scala
Created January 25, 2015 01:11
Scala wrapper around java's ScheduledExecutorService
import java.util.concurrent.ThreadPoolExecutor.AbortPolicy
import java.util.concurrent._
import scala.concurrent.{ Promise, Future }
import scala.concurrent.duration.FiniteDuration
import scala.language.implicitConversions
import scala.util.Try
object ScheduledExecutor {
private val defaultHandler: RejectedExecutionHandler = new AbortPolicy
@rnapier
rnapier / gist:b639da64d5890a0340d5
Last active October 26, 2015 20:50
Simple FFT example
import Accelerate
func spectrumForValues(signal: [Double]) -> [Double] {
// Find the largest power of two in our samples
let log2N = vDSP_Length(log2(Double(signal.count)))
let n = 1 << log2N
let fftLength = n / 2
// This is expensive; factor it out if you need to call this function a lot
let fftsetup = create_fftsetupD(log2N, FFTRadix(kFFTRadix2))
#!/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -i -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
import Foundation
class JSON {
struct Path: Printable {
enum Element {
case Index(Int)
case Key(String)
@steipete
steipete / DevelopmentEnviromentDetector.m
Last active October 30, 2019 03:49
Detect if you're currently running a development version or an App Store/Ad Hoc version.
static BOOL PSPDFIsDevelopmentBuild(void) {
#if TARGET_IPHONE_SIMULATOR
return YES;
#else
static BOOL isDevelopment = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// There is no provisioning profile in AppStore Apps.
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]];
if (data) {
@hjr3
hjr3 / req.md
Last active February 25, 2020 19:51
Job description for Lead Software Engineer

Lead Software Engineer

HauteLook is seeking a Lead Software Engineer with eCommerce experience for a small, cross functional team. The Lead Software Engineer is focused on implementing the technical road map for their designated team. They own the technical implementation process and ensure that best practices and solid engineering principles are being upheld. Equally important, they have a good attitude and energy that empowers the team.

Responsibilities

  • Write and ship code that has the maximum positive impact for HauteLook members and Hautelook as a business
  • Lead a team of 4-5 engineers to do the same
  • Work with product and project managers to create great products
  • Articulate ideas in ways that are helpful and constructive for other members of the team