Skip to content

Instantly share code, notes, and snippets.

View jubianchi's full-sized avatar
🏳️‍🌈
nyan nyan nyan

Julien BIANCHI jubianchi

🏳️‍🌈
nyan nyan nyan
View GitHub Profile
@mageekguy
mageekguy / gist:5222226
Created March 22, 2013 15:35
Using scripts\treemap.php
To known how to use it, just do `php scripts/treemap.php --help`.
By default, there is no analyzer defined, so to add them, create a configuration file and add in it:`
```
<?php
use mageekguy\atoum\scripts\treemap\analyzers;
$script
->addAnalyzer(new analyzers\token())
->addAnalyzer(new analyzers\size())
@mageekguy
mageekguy / .treemap.php
Created March 26, 2013 13:01
Configruation file to generate atoum treemap
<?php
use
mageekguy\atoum\scripts\treemap,
mageekguy\atoum\scripts\treemap\analyzers,
mageekguy\atoum\scripts\treemap\categorizer
;
class commit implements treemap\analyzer
{
@pborreli
pborreli / YourCommand.php
Last active August 23, 2020 09:48
Show progress of a file download inside Symfony 2.3 console #howto
<?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;
@lyrixx
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
@pvh
pvh / gist:6394061
Last active December 22, 2015 01:08

The PHP language owner is responsible for the success of Heroku developers building in PHP. They are part of the broader “languages team”, a group of developers with similar language-specific responsibilities and shared infrastructure.

A language owner will be responsible for varying degrees of

  • building core language-specific features such as the “build pack”,
  • working within the community to improve projects upstream to provide a better experience for Heroku users,
  • customer outreach,
  • customer support,
  • sales support,
  • language-specific documentation and content, and
  • marketing responsibilities such as attending and speaking at conferences.
@ariesjia
ariesjia / IE hack
Created September 4, 2013 10:38
IE6 7 8 9 10 hack
To target IE 6 and 7
@media screen\9 {
body { background: red; }
}
To target IE 6, 7 and 8
@media \0screen\,screen\9 {
body { background: green; }
}
@cvan
cvan / gist:6444031
Created September 4, 2013 23:07
convert URI of image to data URI
// Load an image in your browser and paste this in your console
var i=new Image();i.src=document.location.href;i.onload=function(){var c=document.createElement('canvas');c.width=this.width;c.height=this.height;c.getContext('2d').drawImage(this,0,0);window.location=c.toDataURL('image/png');};
@mageekguy
mageekguy / gist:7302015
Last active December 27, 2015 09:09
CC
# Indenting and Whitespace
Use only tabs, with no space.
Lines should have no trailing whitespace at the end.
Files should be formatted with \n as the line ending (Unix line endings), not \r\n (Windows line endings).
PHP files should be in UTF-8.
PHP files should begin with `<?php ` and should not have a end tag (no `?>`).
The reasons for this can be summarized as:
* Removing it eliminates the possibility for unwanted whitespace at the end of files which can cause "header already sent" errors, XHTML/XML validation issues, and other problems.
* The closing delimiter at the end of a file is optional.
@marmotz
marmotz / bencher.js
Last active December 27, 2015 11:09
VERY simple benchmarker for code. Produce a light report on console.
/**
* VERY simple benchmarker for code.
* Produce a light report on console.
*
* USAGE:
*
* Bencher.get('a bench description').start();
*
* // code here
*
@scalp42
scalp42 / check_resource.rb
Created November 22, 2013 21:04
Figure if a resource exists or not in Chef before notifying it
resource_not_found = {}
begin
resources('ruby_block[my-resource-supposed-to-exist]')
rescue Chef::Exceptions::ResourceNotFound
resource_not_found['ruby_block[my-resource-supposed-to-exist]'] = true
end
template '/etc/my/template.conf' do
source 'template.conf.erb'
mode '640'