Skip to content

Instantly share code, notes, and snippets.

View jayarjo's full-sized avatar
👻
Here, but elsewhere.

Davit Barbakadze jayarjo

👻
Here, but elsewhere.
View GitHub Profile
@jayarjo
jayarjo / editor_plugin.js
Created March 9, 2012 08:24 — forked from dnaber-de/editor_plugin.js
Wordpress TinyMCE Popup-Dialog. German Tutorial on http://dnaber.de/p1477
// js/editor_plugin.js
/**
* an example tinyMCE Plugin
*/
tinymce.create(
'tinymce.plugins.myPlugin',
{
/**
* @param tinymce.Editor editor
* @param string url
@jayarjo
jayarjo / gist:4182073
Created December 1, 2012 12:42
Preload Images
// preload images
function preloadImages() {
var items = [], current = 0, errors = [], timer;
var resetTimer = function() {
stopTimer();
startTimer();
};
@jayarjo
jayarjo / gist:4523490
Last active December 11, 2015 01:29
Plupload - Queue widget example
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Plupload - Queue widget example</title>
<link rel="stylesheet" href="../../js/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="../../js/plupload.full.min.js"></script>
@jayarjo
jayarjo / gist:4696711
Created February 2, 2013 09:13
wp: add/modify columns in post type listing screens
function f__manage_posts_columns($cols)
{
global $typenow;
if ($typenow != 'price_table')
return $cols;
$cols = array(
'cb' => $cols['cb'],
'title' => $cols['title'],
'template' => "Template",
@jayarjo
jayarjo / gist:4708136
Created February 4, 2013 17:23
wp: insert navigation menu
<?php wp_nav_menu(array(
'theme_location' => "top",
'container' => false,
'menu_id' => 'menu-top'
)); ?>
@jayarjo
jayarjo / gist:4721061
Last active December 12, 2015 05:19
redirect non-www to www
# ignore specific path (/administrator/ - in this case)
RewriteCond %{REQUEST_URI} ^/?administrator($|\/|\/.*) [NC]
RewriteRule ^.*$ - [NC,L]
# redirect non-www to www
RewriteCond %{HTTP_HOST} ^yoursite\.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
@jayarjo
jayarjo / gist:5186403
Created March 18, 2013 10:54
truncate text to a specific word length
function truncate($text, $length, $more = '...')
{
$text = strip_shortcodes( $text );
//$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]&gt;', $text);
$text = strip_tags($text);
$words = explode(' ', $text, $length + 1);
if (count($words) > $length) {
array_pop($words);
@jayarjo
jayarjo / gist:5232728
Created March 24, 2013 17:25
make base color darker by a specified factor
function hex_darker($hex, $factor = 30)
{
$new_hex = '';
$base['R'] = hexdec($hex{0}.$hex{1});
$base['G'] = hexdec($hex{2}.$hex{3});
$base['B'] = hexdec($hex{4}.$hex{5});
foreach ($base as $k => $v)
{
language: php
php:
- 5.3
- 5.4
before_script:
- sudo apt-get install apache2
- sudo a2enmod actions
- sudo a2enmod rewrite
language: php
php:
- 5.3
- 5.4
before_script:
- sudo apt-get install apache2
- sudo a2enmod actions
- sudo a2enmod rewrite