Skip to content

Instantly share code, notes, and snippets.

View Neolot's full-sized avatar
🏠
Make the web great again

Yurii Pokhylko Neolot

🏠
Make the web great again
View GitHub Profile
@Neolot
Neolot / gist:9865565
Created March 30, 2014 00:53
MODX REVO SimpleMenu
<?php
if ( $includeDocs ) {
$ids = str_replace(' ','',$includeDocs);
$ids = explode(',', $ids);
$criteria = $modx->newQuery('modResource');
$criteria->sortby('FIELD(modResource.id, '.implode(',',$ids).' )', 'ASC');
$criteria->where(array(
'id:IN' => $ids
));
@Neolot
Neolot / gist:10597184
Created April 13, 2014 18:56
WORDPRESS Remove standard image sizes
<?php
/**
* Remove standard image sizes so that these sizes are not
* created during the Media Upload process
*
* Tested with WP 3.2.1
*
* Hooked to intermediate_image_sizes_advanced filter
* See wp_generate_attachment_metadata( $attachment_id, $file ) in wp-admin/includes/image.php
*
<?php
/**
* Dimox Breadcrumbs
* http://dimox.net/wordpress-breadcrumbs-without-a-plugin/
* Since ver 1.0
* Add this to any template file by calling dimox_breadcrumbs()
* Changes: MC added taxonomy support
*/
function dimox_breadcrumbs(){
/* === OPTIONS === */
@Neolot
Neolot / gist:57515e8366f35e5601aa
Created May 10, 2014 17:12
Convert CSS to SCSS
sass-convert -F css -T scss original_file.css converted_file.scss
@Neolot
Neolot / gist:ea611da6986d7ddcbb38
Created June 30, 2014 11:27
REGEXP Удалить HTML из строки
<[^>]*>
@Neolot
Neolot / gist:8734522b3ff4393f7b96
Created August 9, 2014 16:16
JAVASCRIPT Detect browser and set class to html tag
var BrowserDetect =
{
init: function ()
{
this.browser = this.searchString(this.dataBrowser) || "Other";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
},
searchString: function (data)
{
@Neolot
Neolot / form_handler.php
Last active August 29, 2015 14:10
Обработка данных и отправка служебного письма для Forma Email Logger
<?php
// Служебное письмо на forms@tokkipro.ru
include_once($_SERVER['DOCUMENT_ROOT'].'/path_to_file/tokki.php');
$formdata = array(
'name' => $data['name'],
'phone' => $data['phone'],
'email' => $data['email'],
'message' => $data['message'],
'prim' => $data['some_data'],
);
@Neolot
Neolot / gist:3103760
Created July 13, 2012 08:59
WORDPRESS Registering wp_nav_menu() in 3 locations
<?php
// Function for registering wp_nav_menu() in 3 locations
add_action( 'init', 'register_navmenus' );
function register_navmenus() {
register_nav_menus( array(
'Top' => __( 'Top Navigation' ),
'Header' => __( 'Header Navigation' ),
'Footer' => __( 'Footer Navigation' ),
)
);
@Neolot
Neolot / gist:3103736
Created July 13, 2012 08:50
Remove UTF-8 BOM
find . -type f \( -name '*.css' -o -name '*.js' -o -name '*.txt' -o -name '*.php' -o -name '*.htm' -o -name '*.html' \) -print0 | xargs -0 grep -l `printf '^\xef\xbb\xbf'`
@Neolot
Neolot / gist:3105743
Created July 13, 2012 16:13
WORDPRESS Счетчик Twitter с кэшированием
<?php
// Счетчик Twitter с кэшированием
function nlt_getTwitterCounter($userID='androidbar') {
$output = get_transient('twitter_counter');
if ( $output === false || $output == '' ) {
$data = json_decode(@file_get_contents('http://api.twitter.com/users/' . $userID .'.json'));
$output = $data->followers_count;
set_transient( 'twitter_counter', $output, 60*10 );
}