Skip to content

Instantly share code, notes, and snippets.

View pthiers's full-sized avatar

Philippe Thiers pthiers

  • RiskAmerica SPA
  • Puerto Octay, Chile
  • 11:23 (UTC -04:00)
View GitHub Profile
*~
# KDE directory preferences
.directory
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
/*.iml
@pthiers
pthiers / gist:b424eab9e43b11e6d00c
Last active August 29, 2015 14:17
Imagick: tiff to PNG8
<?php
header('Content-type: image/png');
$image = "/var/www/html/images/image.TIFF";
$im = new Imagick($image);
// resize by 500 width and keep the ratio
$im->thumbnailImage(500, 0);
//Set new image format 'PNG8'
$im->setImageFormat("PNG8");
@pthiers
pthiers / gist:a282069803536c4fcefb
Last active February 27, 2019 12:09
Nginx: php and socket.io reverse proxy
server {
listen 80;
server_name 192.168.0.1;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /srv/www/public_html;
index index.php;
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
@pthiers
pthiers / asyncLoop.js
Last active June 22, 2016 20:58
async loop for array in js
function asyncLoop(array, func, callback) {
var iterations = array.length;
var index = 0;
var done = false;
var loop = {
next: function() {
if (done) {
return;
}
@pthiers
pthiers / gist:130f3ed4b04d12f286529aaed8a5b8ae
Last active June 30, 2016 19:28
web worker with event launcher
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Worker</title>
</head>
<body>
@pthiers
pthiers / xdebug.ini
Last active September 21, 2017 14:52
XDEBUG, profiling config
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.max_nesting_level=256
xdebug.remote_autostart = 1
xdebug.remote_log="/tmp/xdebug.log"
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out-%H-%R
@pthiers
pthiers / regex.js
Last active February 1, 2017 14:55
regex clean comments sql querys
/--.*?\n|#.*|\/\*.*[\s\S]*\*\/
@pthiers
pthiers / fabfile.py
Created April 25, 2017 19:27
Fabric migration git bare folder to gitlab
from fabric.api import env, run, cd, local, sudo
from fabric.contrib import files
from fabric.context_managers import lcd
import gitlab
gitlab_key = 'key'
gitlab_host = 'http://192.168.x.x'
env.hosts = ["192.168.x.x"]
env.user = "usuario"
@pthiers
pthiers / PHP-Array.groovy
Last active May 23, 2024 16:13
datagrip php array extractor
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@pthiers
pthiers / Model.php
Last active July 31, 2017 14:12
'static' way for getting the table name in eloquent, Laravel > 5.2 .
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model as BaseModel;
abstract class Model extends BaseModel
{
protected static $tableName = [];
public static function table(){
$className = get_called_class();