Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
/** | |
* Set cache_namespace_callable: [ pouet, generateShortenedCacheKey ] in your settings.yml | |
* Then the symfony cache key is shortened by MD5 | |
* | |
* @author dalexandre | |
* @see sfViewCacheManager::generateCacheKey | |
* @param sfViewCacheManager $sfViewCacheManager | |
* @return string | |
*/ |
[alias] | |
etat = status | |
pousser = push | |
tirer = pull | |
commettre = commit | |
ranger = stash | |
ajouter = add | |
enlever = rm | |
cloner = clone | |
fusionner = merge |
<?php | |
/** | |
* Download a large distant file to a local destination. | |
* | |
* This method is very memory efficient :-) | |
* The file can be huge, PHP doesn't load it in memory. | |
* | |
* /!\ Warning, the return value is always true, you must use === to test the response type too. | |
* | |
* @author dalexandre |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
#!/bin/bash | |
ES='http://localhost:9200' | |
ESIDX='test3' | |
ESTYPE='test' | |
curl -XDELETE $ES/$ESIDX | |
curl -XPUT $ES/$ESIDX/ -d '{ | |
"settings" : { |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
/** | |
* This casper scipt checks for 404 internal links for a given root url. | |
* | |
* Usage: | |
* | |
* $ casperjs 404checker.js http://mysite.tld/ | |
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42 | |
*/ | |
/*global URI*/ |
<?php | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$progress = $this->getHelperSet()->get('progress'); | |
$ctx = stream_context_create(array(), array('notification' => function ($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) use ($output, $progress) { | |
switch ($notification_code) { | |
case STREAM_NOTIFY_FILE_SIZE_IS: | |
$progress->start($output, $bytes_max); | |
break; |
e_smiley :-) :) :o) :] :3 :c) :> =] 8) =) :} :^) :っ) :-)) :-))) :-)))) :)) :))) :)))) | |
e_laugh :-D :D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D | |
e_sad >:[ :-( :( :-c :c :-< :っC :< :-[ :[ :{ | |
e_wink_frown ;( | |
e_angry :-|| :@ >:( | |
e_cry :'-( :'( | |
e_happy_tears :'-) :') | |
e_disgust D:< D: D8 D; D= DX v.v D-': | |
e_surprise >:O :-O :O :-o :o 8-0 O_O o-o O_o o_O o_o O-O | |
e_kiss :* :^* '}{' |