Skip to content

Instantly share code, notes, and snippets.

View hacfi's full-sized avatar

hacfi hacfi

  • Certified Symfony developer
  • Europe
View GitHub Profile
@hacfi
hacfi / xdebug
Created September 8, 2021 11:21
Xdebug toggle switch
#!/bin/bash
# put into /usr/local/bin/xdebug and make it executable: chmod +x /usr/local/bin/xdebug
# Usage:
# xdebug # toggle...switch on or off, depending of the current state
# xdebug on # enable xdebug
# xdebug off # disable xdebug
@hacfi
hacfi / Kernel.php
Created July 22, 2021 12:15
Symfony 5 Custom runtime to have custom request object
<?php
// src/Kernel.php
declare(strict_types=1);
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
@hacfi
hacfi / libmpdec.rb
Created July 25, 2020 17:58
curl -L https://gist.github.com/hacfi/56b81df179c05c3c42a900555bdcff31/raw/38c2417c92d0e5fb7c892a94fc2a0b36ee81f163/libmpdec.rb -o /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libmpdec.rb
class Libmpdec < Formula
desc "Library for decimal floating point arithmetic"
homepage "https://www.bytereef.org/mpdecimal/"
url "https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.4.2.tar.gz"
sha256 "83c628b90f009470981cf084c5418329c88b19835d8af3691b930afccb7d79c7"
patch do
url "https://gist.githubusercontent.com/lpinca/d967706acabeedb7fb4e8d0be5b66f07/raw/1b9080916e153ac05798a08594cf72c21b4b5a90/dylib-patch.diff"
sha256 "f53486c1a2a7535fae91f0a19f7d2c04ca0b2ee7e5f4c129e8e95e52e6ae9f2e"
end
@hacfi
hacfi / audacity.rb
Last active January 12, 2021 08:32 — forked from varenc/audacity.rb
Unofficial Hombrew Cask for Audacity 2.3.3 (recent 64-bit version). Get around Fosshub's limitations
# Unofficial Hombrew Cask for Audacity 2.3.3 (recent 64-bit version)
# Made entirely for fun and to demonstrate how to get around fosshub's limitations.
# Problem: Audacity's binary is hosted on fosshub and they don't provide a fixed url! The seems to intentionally try to prevent "hot-linking".
# Solution: Make a request to fosshub's special XHR endpoint to get the signed download url. Then just pass that URL to Homebrew
require 'net/http'
require 'json'
require 'uri'
@hacfi
hacfi / activiti.sh
Created July 24, 2016 00:10
Docker run Activiti & Camunda
docker run --name=mysql -d -e 'DB_NAME=activiti' -e 'DB_USER=activiti' -e 'DB_PASS=password' sameersbn/mysql:latest
docker run --name=activiti --rm -it -p 8080:8080 --link mysql:mysql eternnoir/activiti:latest
# open browser at http://{DOCKERIP}:8080/activiti-explorer/
@hacfi
hacfi / sudoers
Created March 5, 2016 14:25
OS X sudoers for allowing Vagrant with vagrant-hostmanager plugin - /etc/sudoers
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
@hacfi
hacfi / disable-xdebug.sh
Created February 5, 2016 00:53
OS X homebrew php 7.0 enable/disable xdebug extension script
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
echo "xdebug disabled"
@hacfi
hacfi / disable-xdebug.sh
Created February 5, 2016 00:45
OS X homebrew php 5.6 enable/disable xdebug extension script
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/5.6/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
echo "xdebug disabled"
@hacfi
hacfi / github_issues_pjax.js
Created January 25, 2016 16:02
GitHub Issues PJAX pagination
$(function () {
var loadedPages = [];
console.log('Initializing GitHub Issues PJAX...');
function group () {
if (loadedPages.length) {
return;
}
var currentPage = +$('.pagination > .current').text();
/*
* smartscroll: debounced scroll event for jQuery *
* based on smartresize by @louis_remi: https://github.com/lrbabe/jquery.smartresize.js *
* Copyright 2011 Louis-Remi & lukeshumard * Licensed under the MIT license. *
*/
var event = $.event,
scrollTimeout;
event.special.smartscroll = {