Skip to content

Instantly share code, notes, and snippets.

@hkarim
hkarim / logic.scala
Created November 27, 2021 00:26
Proofs encoding in Scala trials
package logic
import scala.annotation.targetName
trait Prop
case object True extends Prop
type True = True.type
type ⊤ = True.type
@hkarim
hkarim / ShapelessSlick.scala
Created August 5, 2017 17:09
Auto derivation of Slick GetResult and SetParameter using Shapeless
import java.sql.Timestamp
import com.typesafe.config.{Config, ConfigFactory}
import org.joda.time.DateTime
import shapeless._
import slick.jdbc._
import slick.jdbc.MySQLProfile.api._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
@hkarim
hkarim / gist:a369e1bb4ac8b49beb2335a638dbc465
Created April 4, 2017 16:01 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@hkarim
hkarim / .gitignore
Created December 31, 2016 03:52 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
package com.example
import java.io.ByteArrayOutputStream
import org.joda.time.DateTime
import org.msgpack.core.{MessagePack, MessagePacker, MessageUnpacker}
import scala.language.implicitConversions
import scalaz._
import std.function._
package org.thinkmeta.theory
import scala.collection.immutable.SortedSet
/**
* @author Hossam Karim
*/
// http://en.wikipedia.org/wiki/Chord_names_and_symbols_(popular_music)
//
// Theory.swift
// Chorder
//
// Created by Hossam Karim on 8/26/14.
// Copyright (c) 2014 Hossam Karim. All rights reserved.
//
import Foundation
UPDATE: I was specifying Plugin AU Main Type as: aufx . Apparently it didn't like that very much. But by removing the specification, the Rez error disappeared and it started building again. Still strange that this didn't cause a problem before. I got the inspiration for the change from this link: http://sample-hold.com/2011/11/23/getting-started-with-audio-units-on-os...
Moral of the story is, don't specify a AU Type unless you know its something super fancy. And if you're not a complete bafoon who can't read tool tips like yours truly, there's a suggestion in the introjucer to leave it blank unless you want to use a custom value. I hope that helps others.
import scalaz._
import Scalaz._
import scala.concurrent.ExecutionContext.Implicits.global
val one = Future.successful(1)
val plusOne = (i: Int) => i + 1
val plusTwo = (i: Int) => i + 2
def plusThree(i: Int) = i + 3
def nestedArrayAddToSet[Parent <: HasID, Child <: HasID]
(bsonParentId: String, parentId: Parent#ID,
bsonArrayId: String, childId: Child#ID,
modificationTrace: ModificationTrace)
(implicit parentDao: MongoDao[Parent],
childDao: MongoDao[Child],
parentWriter: BSONWriter[Parent#ID, BSONObjectID],
childWriter: BSONWriter[Child#ID, BSONObjectID],
ec: ExecutionContext): Future[Boolean] =
childDao.findOne(childId).flatMap {