This file contains 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
/* | |
* Display Image from the_post_thumbnail or the first image of a post else display a default Image | |
* Chose the size from "thumbnail", "medium", "large", "full" or your own defined size using filters. | |
* USAGE: <?php echo my_image_display(); ?> | |
*/ | |
function my_image_display($size = 'full') { | |
if (has_post_thumbnail()) { | |
$image_id = get_post_thumbnail_id(); | |
$image_url = wp_get_attachment_image_src($image_id, $size); |
This file contains 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
closure to generate hashed filename for Phalcon template compiled path kind of file: | |
```php | |
<?php | |
$volt->setOptions(array( | |
'compiledPath' => function($templatePath) { | |
return md5($templatePath) . '.php'; | |
} | |
)); |
This file contains 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
#!/usr/bin/python2 | |
# | |
# Youtube-upload is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# Youtube-upload is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains 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 | |
date_default_timezone_set('UTC'); | |
// Create keys at hhttps://portal.aws.amazon.com/gp/aws/securityCredentials | |
class AmazonClient { | |
/** @var cURL */ | |
public $curl; |
This file contains 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/sh | |
# | |
# Script to prepare and restore full and incremental backups created with innobackupex-runner. | |
# | |
# This script is provided as-is; no liability can be accepted for use. | |
# | |
# UPDATE: 21/11/2015 | |
INNOBACKUPEX=innobackupex | |
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX |
This file contains 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 | |
function avia_woocommerce_enabled() | |
{ | |
if (defined("WOOCOMMERCE_VERSION")) { return true; } | |
return false; | |
} | |
This file contains 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
sudo apt-get clean | |
sudo add-apt-repository ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt-get upgrade git |
This file contains 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
# Check requirement | |
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production | |
# Check everything is working | |
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production | |
sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production | |
# Troubleshot: Commit / Merge Request Error # | |
This file contains 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
you can use such conditions to show private posts only to logged in users with role contributor. Now you only need to make post private to make that post available for contributor. | |
Ref: http://wordpress.stackexchange.com/questions/60582/limit-access-to-posts-pages-by-user-roles | |
<?php | |
if ( have_posts() ) : while ( have_posts() ) : the_post(); | |
$private = get_post_custom_values("private"); | |
if (isset($private[0]) && $private == "true") { | |
if ( current_user_can( 'contributor' ) ) { //passing role to it may sometime not work | |
the_title(); |
This file contains 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
Ref: http://albertolarripa.com/2013/07/10/megatools-synchronizing-your-backups-to-mega/ | |
#!/bin/sh | |
MEGASYNC='/usr/local/bin/megasync' | |
MEGARM='/usr/local/bin/megarm' | |
LOCALDIR="/usr/local/data/backups" | |
REMOTEDIR="/Root/albertolarripa/backups" | |
SEDLOCALDIR="\/usr\/local\/data\/backups" | |
SEDREMOTEDIR="\/Root\/albertolarripa\/backups" |
OlderNewer