Skip to content

Instantly share code, notes, and snippets.

View macmladen's full-sized avatar

Mladen Đurić macmladen

View GitHub Profile
<?php
/**
* You can easily parse command line arguments into the
* $_GET variable by using the parse_str() function.
*/
parse_str(implode('&', array_slice($argv, 1)), $_GET);
/**
* PHP error reporting activation
*/
@macmladen
macmladen / apache
Created April 7, 2014 08:23
Apache
# .htaccess:
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/gamasup/.htpasswd
AuthGroupFile /dev/null
require valid-user
# .htpasswd:
a:fNU9ioFLlnGn6
Barracuda [Mon Jul 28 13:03:10 UTC 2014] ==> BOA Skynet welcomes you aboard!
Barracuda [Mon Jul 28 13:03:15 UTC 2014] ==> INFO: UPGRADE
Barracuda [Mon Jul 28 13:03:15 UTC 2014] ==> INFO: Reading your /root/.barracuda.cnf config file
Barracuda [Mon Jul 28 13:03:16 UTC 2014] ==> NOTE! Please review all config options displayed below
Barracuda [Mon Jul 28 13:03:16 UTC 2014] ==> NOTE! It will *override* all settings in the Barracuda script
Barracuda [Mon Jul 28 13:03:16 UTC 2014] ==> Legacy PHP-CLI 5.2 is not used on this system
Barracuda [Mon Jul 28 13:03:16 UTC 2014] ==> Legacy PHP-FPM 5.2 is not used on this system
@macmladen
macmladen / Guardfile
Last active August 29, 2015 14:06
Guard file sample. This may work for any project you just need to add/customize commands for your guards. It may help to generate guard init which will create samle file first and then merge with this one (not literally!). Under comments there are some samples to give you ideas what may be done and how. You will need guard gem and plugins you ne…
# A sample Guardfile based on Omega 4.x and init result
# More info at https://github.com/guard/guard#readme
# for this file to work you need some gem-s
# copy the following without hashtag to Gemfile:
# source 'https://rubygems.org'
#
# group :development do
#
# # Sass, Compass and extensions.
// Find events on element http://stackoverflow.com/a/2519061/1099667
// initially with alert() but changed to console.log()
// jQuery 1.8+
$.each($("#element").data("events"), function(i, e) {
alert(i);
});
//jQuery 1.4+
$.each($("#element").data("events"), function(i, event) {
console.log(i);
$.each(event, function(j, h) {
@macmladen
macmladen / .exclude.rsync.sh
Last active August 29, 2015 14:16
.exclude.rsync used to hold exclude for rsyncing Drupal site local <-> live, used shell syntax for highlighting
# Rsync EXCLUDE configuration to user@server.com:public_html
# test drive, remove n to actually sync
# I - ignore time, c - checksum, grep to exclude unchanged files
# rsync -aniIc --exclude-from=.exclude.rsync ./ user@server.com:public_html/ | grep -v "^\."
# Not needed on live:
.git*
sites/all/drush
.exclude.rsync
@macmladen
macmladen / bash_functions.sh
Created April 3, 2015 08:26
Some useful bash functions to be included (sourced) in your bash scripts
# promptyn "{message}" {default_answer}
# $1 "{message}" like "Do you wish to procede? [Yn]"
# $2 {default_answer} you can pass default value, just notify that in message above
# @return
# 0 for any of y, Y, yes, YAYA, yabbadabbadoo
# 1 for any of n, N, Nein, nikako, nonononoooo
promptyn() {
while true; do
read -p "$1 " yn
CHOICE=${yn:0:1}
@macmladen
macmladen / drush-si.sh
Created August 30, 2015 10:37
drush site-install template
dr si standard \
--account-mail=lucar_loc@bluefish.rs \
--account-name=admin \
--account-pass=plavac \
\
# --db-su=lokalni \
# --db-su-pw=lokalni \
--db-url=mysql://lokalni:lokalni@localhost/lucar \
# --locale=<en-GB> \
\
@macmladen
macmladen / phjs-screencapture.js
Created September 18, 2015 12:30
Script to capture screen using phantomjs.org headless
// Copyright: (C) 2015 MacMladen <macmladen@gmail.com>
// License: GPL-2.0
// Prequisite:
// having installed phantomjs from http://phantomjs.org
// You have to change variables to suit your needs
// Usage:
// $ phantomsj script.js
// it will produce capture file in same folder
// you can figure out the rest ;)
var
@macmladen
macmladen / Solr.md
Last active September 25, 2015 18:22
Installing Apache Solr search engine on server and integrating with Drupal