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
| find path/to/Bundle/Controller -type f -name '*.php' -exec sed -i '' 's/createForm(new \(.*\)()/createForm(\1::class/' {} \; |
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
| var assign = require('object-assign'); | |
| var Promise = require('es6-promise').Promise; | |
| var EventEmitter = require('eventemitter2').EventEmitter2; | |
| function buildQueryString(object, prefix) { | |
| var out = []; | |
| for (var prop in object) { | |
| if (!object.hasOwnProperty(prop)) { | |
| continue; | |
| } |
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
| #!/usr/bin/env boot | |
| (require '[clojure.string :as string]) | |
| (defn- str->int [s] | |
| (Integer/parseInt s)) | |
| (defn- positive? [n] | |
| (> n 0)) |
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
| (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 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
| #!/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 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
| <?php | |
| interface SomeObjectRepository | |
| { | |
| public function getByIdentifier($id); | |
| public function findAll(); | |
| public function add(SomeObject $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
| <?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 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
| <?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 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
| <?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 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
| #!/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+")))}) |