Skip to content

Instantly share code, notes, and snippets.

View viezel's full-sized avatar

Mads Møller Schrøder viezel

View GitHub Profile
@viezel
viezel / composer.json
Created April 30, 2019 12:24
Gitlab Project Migrations
{
"name": "napp/gitlab-migration",
"require": {
"php-http/guzzle6-adapter": "^1.0",
"m4tthumphrey/php-gitlab-api": "^9.13"
}
}
@viezel
viezel / README.md
Last active July 30, 2018 13:21 — forked from manuelselbach/README.md
xdebug docker on macOS with PhpStorm

Use xdebug with docker on macOS and PhpStorm

To use xdebug with macOS and docker is quite, let´s call it tricky ;)

The following steps need to be proceed to get it working:

  1. use the config from the xdebug.ini wihtin your docker web container. Important: set remote_connect_back to off
  2. set up an alias for your local interface (lo)

To bring up the alias at startup, you can either (sudo may be needed here):

@viezel
viezel / bash.sh
Last active November 18, 2021 17:10
ghostscript - pdf conversion
## using Ghostscript, poppler-utils & qpdf
# gs docs: https://ghostscript.com/doc/9.18/Use.htm#Other_parameters
# poppler: https://freedesktop.org/wiki/Software/poppler/
# qpdf docs: http://qpdf.sourceforge.net/files/qpdf-manual.html
# optimize pdf to use use CropBox, remove dublicate image refs, compress
gs -sDEVICE=pdfwrite -dUseCropBox -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dDetectDuplicateImages=true -sOutputFile=test-out.pdf test.pdf
@viezel
viezel / import.php
Last active February 20, 2023 08:33
Import test using Laravel-Excel
<?php
public function import(Request $request)
{
ini_set('max_execution_time', 300);
info("\n\n------------------ NEW ---------------------- ");
info("Start import: " . (memory_get_usage()/1024/1024) . " MB");
$before = microtime(true);
// use chunk to import the products from CSV
@viezel
viezel / imagick-3.4.0-PHP7-forge.sh
Created June 22, 2016 16:18 — forked from pascalbaljet/imagick-3.4.0-PHP7-forge.sh
Install Imagick 3.4.0 on PHP 7.0 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
@viezel
viezel / ClearBeanstalkdQueueCommand.php
Last active August 29, 2015 14:27 — forked from lukaswhite/ClearBeanstalkdQueueCommand.php
Clear a Beanstalkd Queue in Laravel
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ClearBeanstalkdQueueCommand extends Command {
/**

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@viezel
viezel / app.js
Created March 23, 2015 09:25
Example of how to use TiCollectionView
$.listView.addEventListener("contextMenuClick", function(e){
alert( "You clicked on menu item " + e.index + " - CollectionView item " + e.itemIndex );
});
$.listView.addEventListener("pull", function(e){
Ti.API.info(e);
});
$.listView.addEventListener("pullend", function(e){
//
// Start the app while being offline
// Then after these requests have been cache - go back online
//
// require this lib
var HTTPHelper = require("networkHelper");
// the http request will auto try to send queued requests when being online again
HTTPHelper.httpRequest({
@viezel
viezel / app.js
Last active August 29, 2015 14:14
appcelerator - HTTP requsts queing system while being offline
//
// Start the app while being offline
// Then after these requests have been cache - go back online
//
var HTTPHelper = require("networkHelper");
// simulate some request while being offline
for(var i = 0; i < 5; i++){
setTimeout(function(){