Skip to content

Instantly share code, notes, and snippets.

View madalinignisca's full-sized avatar
🏡
Open for business

Madalin Ignisca madalinignisca

🏡
Open for business
View GitHub Profile
@madalinignisca
madalinignisca / router.php
Created April 13, 2016 13:40
basic PHP router for built in server
<?php
if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
$_GET['_url'] = $_SERVER['REQUEST_URI'];
}
return false;
lucasta $ composer require -vvv friendsofcake/crud-view
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Reading ./composer.json
Loading config file /Volumes/Data/Users/m/.composer/config.json
Loading config file /Volumes/Data/Users/m/.composer/auth.json
Loading config file ./composer.json
Checking CA file /private/var/folders/6x/ff39wr016ys25ffbp8xwzd9c0000gn/T/composer-cacert-39eaf16e26c08cc90d728865f1c60406ee5d864d5963f72ede2a1cbb127f95ca.pem
Executing command (/Volumes/Data/Users/m/Documents/Workspace/projects/www/lucasta): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /Volumes/Data/Users/m/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
@madalinignisca
madalinignisca / README.md
Last active March 2, 2016 09:49
Bootstrap Burger animated icon to X
@madalinignisca
madalinignisca / README.md
Created October 22, 2015 08:09
Yii serve using PHP's built in server

Found this on Yii wiki: Yii 2.0: PHP built-in server integration

Really cool and my default when working with Yii.

Place the ServeController.php file in "commands/" folder.

From the root of your project run "./yii serve" on Linux/BSD/OSX or "yii.bat serve" on Windows.

Open your browser to "http://localhost:8080" and work.

@madalinignisca
madalinignisca / position-on-scroll-snippet.js
Created September 24, 2015 09:00
Get position on window scroll
/* This is a snippet found on stackoverflow: http://stackoverflow.com/questions/3714628/jquery-get-the-location-of-an-element-relative-to-window
*/
function log(txt) {
$("#log").html("location : <b>" + txt + "</b> px")
}
$(function() {
var eTop = $('#element').offset().top; //get the offset top of the element
log(eTop - $(window).scrollTop()); //position of the ele w.r.t window
@madalinignisca
madalinignisca / backupdb.sh
Created July 10, 2015 14:57
Backup the database from bash, zip it and delete any older then X days. Good to use with Cron when hosting websites.
#!/bin/bash
# replace what is in [[ ]] with necessary variables
# Database credentials
user="[[username]]"
password="[[password]]"
host="[[host]]"
db_name="[[database_name]]"
# Other options
backup_path="[[path_to_backup_folder]]"
@madalinignisca
madalinignisca / wp-config-alternate-cron.php
Last active August 29, 2015 14:24
WordPress wp-config.php extra snippets for better performance and security
<?php // Use this when you use normal web cron and scheduled posts don't get published
define( 'ALTERNATE_WP_CRON', true );

#FOR MULTIPLE REDIS INSTANCE INSTALLATION ON RHEL7+ USE THE FOLLOWING PATHS AND SETUP PROCESS:

  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
@madalinignisca
madalinignisca / scripts.js
Created June 7, 2015 17:48
Make images added by Redactor responsive in Concrete5 7.x+
// add img-responsive class to Redactor added images
$('p[data-redactor-inserted-image=true]').find('img').addClass('img-responsive');
@madalinignisca
madalinignisca / hhvm_php.ini
Last active August 29, 2015 14:21 — forked from tektoh/hhvm_php.ini
hhvm for concrete5
; php options
session.save_handler = files
session.save_path = /var/lib/php5
session.gc_maxlifetime = 1440
short_open_tag = Off
expose_php = Off
; hhvm specific
hhvm.log.level = Warning