Skip to content

Instantly share code, notes, and snippets.

View maliMirkec's full-sized avatar
🤘
I’m really good at this without realising how.

Silvestar Bistrović maliMirkec

🤘
I’m really good at this without realising how.
View GitHub Profile
@maliMirkec
maliMirkec / Paginator.php
Last active August 29, 2015 14:21
Phalcon Paginator with full URI
<?php
use Phalcon\Paginator\Adapter\Model;
use Phalcon\Http\Request;
class Paginator extends Phalcon\Paginator\Adapter\Model {
public function getPaginate($page_param = false) {
if(!$page_param) {
$page_param = "page";
@maliMirkec
maliMirkec / imagick
Created June 15, 2015 06:03
How to install and include ImageMagick on ubuntu
// update package list
sudo apt-get update
// install ImageMagick
sudo apt-get install imagick
// test if ImageMagick is working
cd /path/to/folder/with/images/ && convert -negate image.gif output.gif
// install php imagick
@maliMirkec
maliMirkec / cmd
Created August 18, 2015 07:02
how to execute php script from command line
// execute php script from command line
// http://stackoverflow.com/questions/6763997/shell-run-execute-php-script-with-parameters
wget -O - -q -t 1 "http://mysite.com/file.php?param=value" >/dev/null 2>&1
@maliMirkec
maliMirkec / cache-github-credentials
Created October 7, 2015 05:40
Cache GitHub credentials
git config --global credential.helper wincred
@maliMirkec
maliMirkec / folder-size
Created October 14, 2015 18:58
Display size of the folder
// display size of the folder
du -hs /path/to/directory
@maliMirkec
maliMirkec / wp-install
Created October 15, 2015 12:09
Wordpress installation on Ubuntu
// connect to database
mysql -u root
// create new database for wp
CREATE DATABASE wordpress;
// check database user in vesta cp
// grant database user all privileges for wp database, admin_default is database user by default
GRANT ALL PRIVILEGES ON wordpress.* TO admin_default@localhost;
@maliMirkec
maliMirkec / phalcon-update
Last active October 17, 2015 07:58
How to update Phalcon on Vagrant
// Add Phalcon repository
sudo apt-add-repository -y ppa:phalcon/stable
sudo apt-get update
// Install PhalconPHP
sudo apt-get install -y php5-phalcon
// Install PhalconPHP DevTools
cd ~
@maliMirkec
maliMirkec / VagrantPhalconHost.conf
Last active October 17, 2015 07:59
How to add and configure host on Vagrant Phalcon
# add this to /etc/apache2/sites-available/vagrant.conf
# rename "app-name" to your application name
# don't forget to configure your local hosts file
<VirtualHost *:80>
ServerName app-name.app-com
DocumentRoot "/vagrant/www/app-name/"
<Directory "/vagrant/www/app-name/">
Options Indexes Followsymlinks
AllowOverride All
@maliMirkec
maliMirkec / sendfile
Last active October 23, 2015 13:35
Turn off sendfile option if you see strange characters in your assets files using vagrant and virtual box
// http://stackoverflow.com/questions/9479117/vagrant-virtualbox-apache2-strange-cache-behaviour
// Apache
EnableSendfile off
// nging
sendfile off
@maliMirkec
maliMirkec / replace_string.sql
Last active October 27, 2015 17:58
Replace string in database
UPDATE table_name
SET column_name = REPLACE(column_name, 'old_string_part', 'new_string_part');