This file contains 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
(require '[clojure.string :as string]) | |
(defn- str->int [s] | |
(Integer/parseInt s)) | |
(defn- parse-time [timestr] | |
(let [[hours mins secs-and-ampm] (string/split timestr #":" 3) | |
secs (subs secs-and-ampm 0 2) | |
ampm (subs secs-and-ampm 2)] | |
{:hours (str->int hours) |
This file contains 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
#!/usr/bin/env boot | |
(require '[clojure.string :as string]) | |
(defn- str->int [s] | |
(Integer/parseInt s)) | |
(defn- parse-row [row expected-count] | |
{:post [(= expected-count (count %))]} | |
(map str->int (string/split row #"\s+"))) |
This file contains 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
<?php | |
interface SomeObjectRepository | |
{ | |
public function getByIdentifier($id); | |
public function findAll(); | |
public function add(SomeObject $object); |
This file contains 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
<?php | |
interface Article | |
{ | |
public function getIdentifier(); | |
public function getTitle(); | |
public function setTitle($title); | |
public function getBody(); | |
public function setBody($body); | |
public function getYear(); |
This file contains 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
<?php | |
$mongo = new \MongoClient(); | |
$col = $mongo->testDb->testCollection; | |
$col->drop(); | |
$col->insert(['test' => 'one']); | |
// works perfectly | |
var_dump(iterator_to_array($col->find([ | |
'test' => 'one', | |
], ['test']))); |
This file contains 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
<?php | |
$mongo = new \MongoClient(); | |
$col = $mongo->testDb->testCollection; | |
$col->drop(); | |
// only returns the `_id` attribute, despite the "fields" argument | |
var_dump($col->findAndModify([ | |
'test' => 'one', |
This file contains 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
#!/usr/bin/env boot | |
(require '[clojure.string :as string]) | |
(defn- string->int [string] | |
(Integer/parseInt string)) | |
(defn- make-case [[credit num-items items]] | |
{:credit (string->int credit) | |
:items (map-indexed vector (map string->int (string/split items #"\s+")))}) |
This file contains 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
<?php | |
return array( | |
'AD' => 'Andorra', | |
'AE' => 'United Arab Emirates', | |
'AF' => 'Afghanistan', | |
'AG' => 'Antigua and Barbuda', | |
'AI' => 'Anguilla', | |
'AL' => 'Albania', | |
'AM' => 'Armenia', | |
'AO' => 'Angola', |
This file contains 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
<?php | |
use Doctrine\Common\EventSubscriber; | |
use Doctrine\DBAL\Events; | |
use Doctrine\DBAL\Event\ConnectionEventArgs; | |
final class EnableSavepointsListener implements EventSubscriber | |
{ | |
/** | |
* {@inheritdoc} |
This file contains 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
<?php | |
interface Ham | |
{ | |
public function halp(\stdClass $obj=null); | |
} | |
class Spam implements Ham | |
{ | |
public function halp(\stdClass $obj) |