This is adapted from this Codepen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) { | |
$_GET['_url'] = $_SERVER['REQUEST_URI']; | |
} | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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]]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add img-responsive class to Redactor added images | |
$('p[data-redactor-inserted-image=true]').find('img').addClass('img-responsive'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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 |