This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am ruurtjan on github. | |
* I am ruurtjan (https://keybase.io/ruurtjan) on keybase. | |
* I have a public key ASDrUF-JhLiWYlDnwjSHRsKzDYfQWupmAxQyB9huh-FQLAo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set WshShell = CreateObject("WScript.Shell") | |
Key = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" | |
DigitalID = WshShell.RegRead(key & "DigitalProductId") | |
ProductName = "Product Name: " & WshShell.RegRead(Key & "ProductName") & vbNewLine | |
ProductID = "Product ID: " & WshShell.RegRead(Key & "ProductID") & vbNewLine | |
ProductKey = "Installed Key: " & ConvertToKey(DigitalID) | |
ProductID = ProductName & ProductID & ProductKey | |
If vbYes = MsgBox(ProductId & vblf & vblf & "Save to a file?", vbYesNo + vbQuestion, "Windows Key Information") then | |
Save ProductID | |
End if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VectorImplicits._ | |
import model.{Matrix2, Vector2} | |
object MatrixImplicits { | |
implicit class ArithmeticMatrixImplicits(m: Matrix2) { | |
def *(m2: Matrix2): Matrix2 = ??? | |
def *(scalar: Float): Matrix2 = ??? | |
def determinant(): Float = ??? | |
def changesOrientation(): Boolean = ??? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MatrixImplicits._ | |
import model.{Matrix2, Vector2} | |
object VectorImplicits { | |
implicit class ArithmeticVectorImplicits(v: Vector2) { | |
def +(v2: Vector2): Vector2 = ??? | |
def *(scalar: Float): Vector2 = ??? | |
def *(m: Matrix2): Vector2 = ??? | |
def isLinearlyDependent(v2: Vector2): Boolean = ??? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Utils.toPositive(Utils.murmur2(keyBytes)) % numPartitions; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val filter = EmailFilter.senderIsNot(Address("[email protected]")) && | |
EmailFilter.bodyContains("Unsubscribe") | |
val newsletters = emails.filter(filter.run) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait EmailFilter | |
final case object Always extends EmailFilter | |
final case class Not(filter: EmailFilter) extends EmailFilter | |
final case class And(left: EmailFilter, right: EmailFilter) extends EmailFilter | |
final case class SenderEquals(target: Address) extends EmailFilter | |
final case class RecipientEquals(target: Address) extends EmailFilter | |
final case class BodyContains(phrase: String) extends EmailFilter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val always: EmailFilter = Always | |
val never: EmailFilter = always.negate | |
def senderIs(sender: Address): EmailFilter = SenderEquals(sender) | |
def senderIsNot(sender: Address): EmailFilter = SenderEquals(sender).negate | |
def recipientIs(recipient: Address): EmailFilter = RecipientEquals(recipient) | |
def recipientIsNot(recipient: Address): EmailFilter = RecipientEquals(recipient).negate | |
def senderIn(senders: Set[Address]): EmailFilter = senders.foldLeft(never)(_ || senderIs(_)) | |
def recipientIn(recipients: Set[Address]): EmailFilter = recipients.foldLeft(never)(_ || recipientIs(_)) | |
def bodyContains(phrase: String): EmailFilter = BodyContains(phrase) | |
def bodyDoesNotContain(phrase: String): EmailFilter = BodyContains(phrase).negate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait EmailFilter { self => | |
def &&(that: EmailFilter): EmailFilter = EmailFilter.And(self, that) | |
def ||(that: EmailFilter): EmailFilter = (self.negate && that.negate).negate | |
def negate : EmailFilter = EmailFilter.Not(self) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Original { | |
def flatMap[A, B](l: List[A], f: A => List[B]): List[B] = ??? | |
def flatten[A](l: List[List[A]]): List[A] = | |
Original.flatMap(l, (as: List[A]) => as) | |
def map[A, B](l: List[A], f: A => B): List[B] = | |
Original.flatMap(l, List(_)) | |
} |
OlderNewer