Skip to content

Instantly share code, notes, and snippets.

View mikaelz's full-sized avatar

Michal Zuber mikaelz

View GitHub Profile
<?php
$pdo = new PDO("mysql:host=HOSTNAME", "USERNAME", "PASSWORD");
$query = $pdo->prepare("SHOW DATABASES");
$query->execute();
foreach ($query->fetchAll(PDO::FETCH_OBJ) as $row) {
$db = $row->Database;
echo "= $db =" . PHP_EOL;
$pdo->exec("USE $db");
<?php
/*
Plugin Name: R Debug
Description: Set of helper dump functions for debug.
Author: Andrey "Rarst" Savchenko
Author URI: http://www.rarst.net/
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@mikaelz
mikaelz / php-compile.sh
Last active December 17, 2015 21:38 — forked from JeffreyWay/gist:3185773
configure for php compile
// http://kubyshkin.ru/posts/installing-php-xdebug-extension-on-mac-os-x-10-7-lion.html
MACOSX_DEPLOYMENT_TARGET=10.7
CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
./configure \
--prefix=/usr \
@mikaelz
mikaelz / notify.sh
Created February 11, 2014 05:48 — forked from jehiah/notify.sh
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: notify email address on system boot.
# *************************************************
# Installing:
# 1) save as /etc/rc.d/init.d/notify
# 2) set the desired email address in "MAILADD" variable
# 3) chmod a+w /etc/rc.d/init.d/notify
@mikaelz
mikaelz / README
Last active December 8, 2022 22:18 — forked from johntyree/soundcloud
Fill MPC/MPD playlist with SoundCloud stream URLs
Options:
soundcloud.py --genre
soundcloud.py search
soundcloud.py user
soundcloud.py tracks
soundcloud.py url
soundcloud.py playlist
Usage:
@mikaelz
mikaelz / javascript_loader.js
Last active September 27, 2015 15:19 — forked from hagenburger/javascript_loader.js
Dynamically load JavaScript files with callback when finished
// Example:
Loader.load("/script/main.js");
Loader.load(base_url + '/include/fancybox2/jquery.fancybox.pack.js', function() {
$('.fancybox').fancybox();
});
var Loader = {
load: function(src, callback) {
var script = document.createElement('script'),
@mikaelz
mikaelz / post-receive
Created June 19, 2016 05:27 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
# Basic commands
:Git [args] # does what you'd expect
all of your `~/.gitconfig` aliases are available.
:Git! [args] # same as before, dumping output to a tmp file
Moving inside a repo.
@mikaelz
mikaelz / .htaccess
Created June 4, 2017 13:05 — forked from pranid/.htaccess
Prestashop .htaccess file for localhost :: please replace text 'yourproject' with your folder name
# ~~start~~ Do not remove this comment, prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by prestashop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine on
@mikaelz
mikaelz / git-fork-update.md
Last active July 29, 2017 11:07 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd YOUR-FORKED-REPO
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream