Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ludofleury's full-sized avatar
🐼
Yay

Ludovic Fleury ludofleury

🐼
Yay
View GitHub Profile
A - B - C <-- branch develop
\
D - E - F <-- branch feature.alpha
A - B - C <-- branch develop
\
Z <-- branch feature.alpha
My repository: the common ancestor is B.
A - B - C <-- branch develop
\
D - E - F - G <-- branch feature.alpha
source "http://rubygems.org"
gem 'bundler', "~>1.0.10"
gem "rails", "2.3.11"
gem "mysql"
gem "erubis"
gem "rake"
gem "syntax", "1.0.0"
gem "capistrano", "2.6.0"
gem "open4", "0.9.3"
@ludofleury
ludofleury / cURL.php
Created December 21, 2011 10:02
Post Json with cURL
<?php
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('http://api.plemi.lan/app_dev.php/demand');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
[Wed Dec 21 12:12:28 2011] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'Swift_TransportException' with message 'Expected response code 220 but got code "", with message ""' in /srv/api/vendor/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:422\nStack trace:\n#0 /srv/api/vendor/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(315): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array)\n#1 /srv/api/vendor/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(123): Swift_Transport_AbstractSmtpTransport->_readGreeting()\n#2 /srv/api/vendor/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php(57): Swift_Transport_AbstractSmtpTransport->start()\n#3 /srv/api/vendor/swiftmailer/lib/classes/Swift/MemorySpool.php(65): Swift_Transport_SendmailTransport->start()\n#4 /srv/api/vendor/symfony/src/Symfony/Bundle/SwiftmailerBundle/EventListener/EmailSenderListener.php(47): Swift_MemorySpool->flushQueue(Object(Swift_Transport_SendmailTr
/**
* Description
*
* @param hey
*
* @return pwet
*
* @Mongo/Hey
* @Assert/Url()
*/
@ludofleury
ludofleury / A-result.txt
Created January 31, 2012 04:21
PHP get_class vs ReflectionObject vs ReflectionClass
This was a quick & dirty benchmark (for my own needs) to compare the method to get a class name in PHP
-ReflectionObject->getName();
-get_class();
-ReflectionClass->getName();
It was performed on my local machine : MacBookPro with PHP 5.3.6
You will find the result below and the code used for the 3 tests.
ReflectionObject
Memory : 750040
@ludofleury
ludofleury / compare.php
Created February 22, 2012 17:04 — forked from naholyr/compare.php
Extract namespace from a PHP file
<?php
// Works in every situations
function by_token ($src) {
$class = false;
$namespace = false;
$tokens = token_get_all($src);
for ($i = 0, $count = count($tokens); $i < $count; $i++) {
$token = $tokens[$i];
@ludofleury
ludofleury / asserters-comparison.php
Created March 30, 2012 17:09
Atoum asserters vs PHPUnit asserters
<?php
// Atoum asserters
$this->assert
->integer(150)
->isGreaterThan(100)
->isLowerThanOrEqualTo(200);
// PHPunit asserters
$this->assertInternalType('int', 150);