Skip to content

Instantly share code, notes, and snippets.

@skuppa
skuppa / ios.md
Created April 12, 2015 03:22
Mac Tips

Export keychain into plain text

security dump-keychain -d login.keychain > keychain.txt

-- account : username
-- data : password
@skuppa
skuppa / scala_example.md
Last active February 13, 2018 15:32
Scala Collection

Merge collection by group by

case class Channel(name: String,
                  deviceIds: List[String])

object Channel {
  def copy(c: Channel, newDevicesIds: List[String]) = c.copy(deviceIds = if(c.deviceIds == newDevicesIds) c.deviceIds else c.deviceIds ::: newDevicesIds)
}

def mergeDevices(channels: List[Channel]): Channel = { channels.foldLeft(channels.head) ((r, c) => Channel.copy(r, c.deviceIds)) }