Skip to content

Instantly share code, notes, and snippets.

<?php
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_STRING);
$data = ["username" => filter_input(INPUT_POST, "name", FILTER_SANITIZE_STRING),
"comment" => filter_input(INPUT_POST, "comment", FILTER_SANITIZE_STRING),
];
$posts->updateOne(["_id" => new MongoDB\BSON\ObjectID($id)], ['$push' => ["comments" => $data]]);
vagrant up
Bringing machine 'joindin' up with 'virtualbox' provider...
==> joindin: Importing base box 'joindin/development'...
==> joindin: Matching MAC address for NAT networking...
==> joindin: Setting the name of the VM: vm_joindin_1464623655510_48026
==> joindin: Clearing any previously set network interfaces...
==> joindin: Preparing network interfaces based on configuration...
joindin: Adapter 1: nat
joindin: Adapter 2: hostonly
==> joindin: Forwarding ports...

Keybase proof

I hereby claim:

  • I am lornajane on github.
  • I am lornajane (https://keybase.io/lornajane) on keybase.
  • I have a public key whose fingerprint is 6AED D723 08F8 0865 FE8B 5A39 7DFC 33E8 65AB FE1F

To claim this, I am signing this object:

@lornajane
lornajane / Message.php
Created August 9, 2013 08:13
Toy Messages classes
<?php
class Message
{
public function __construct($msg, $user) {
$this->msg = $msg;
$this->user = $user;
$this->created = new DateTime();
}
function makeImgTag($src) {
return "<img src=\"" . $src . "\" />";
}
@lornajane
lornajane / benchmarks
Last active December 18, 2015 01:38
PHP benchmarks and version adoption, May 2013
Average time to run bench.php on my laptop, by PHP version
• 5.2.17: 3.77 seconds
• 5.3.23: 2.63 seconds
• 5.4.15: 1.98 seconds
• 5.5RC1: 2.11 seconds
@lornajane
lornajane / get.php
Created May 2, 2013 13:53
Get a list of my gists with PHP streams
<?php
ini_set('user_agent', "PHP"); // github requires this
$api = 'https://api.github.com';
$url = $api . '/users/lornajane/gists';
// make the request
$response = file_get_contents($url);
// check we got something back before decoding
@lornajane
lornajane / poem.txt
Created May 2, 2013 11:00
Rather Lame Poetry
If I had the time, I'd make a rhyme
@lornajane
lornajane / text.txt
Created December 20, 2012 15:37
Gist created by API
Some riveting text
@lornajane
lornajane / gist:4131314
Created November 22, 2012 14:01
localhost index
<?php
// phpinfo();
echo "verb: " . $_SERVER['REQUEST_METHOD'] . "\n";
echo "headers:";
var_dump(apache_request_headers());
echo "\n";