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
RewriteEngine on | |
RewriteRule ^composer\.(lock|json)$ - [F,L] | |
RewriteRule ^vendor/.*$ - [F,L] |
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
(loop [rng (range 10)] | |
(when-let [i (first rng)] | |
(println (apply str (repeat i i))) | |
(recur (rest rng)))) |
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 | |
namespace PMG\FromScratch\AppBundle; | |
use Symfony\Component\HttpKernel\Bundle\Bundle; | |
final class AppBundle extends Bundle | |
{ | |
// noop | |
} |
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 | |
/** | |
* The idea here is that there's a singleton-esque thing. We don't want to cause | |
* side effects like adding actions/filters in a constructor, so we delegate that | |
* to the `hook` method. `instance` provides a way for things that need to un-hook | |
* things to get a reference to the "global" instance. | |
*/ | |
abstract class Base | |
{ |
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) |
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 | |
$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
<?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 | |
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 | |
/* | |
Plugin Name: Kill Attachment Pages | |
Plugin URI: http://pmg.co/ | |
Description: Redirects all attachment pages to their parent page | |
Version: 1.0 | |
Author: Christopher Davis | |
Author URI: http://pmg.co/people/chris | |
License: creative commons/GPL2 | |
*/ |