Skip to content

Instantly share code, notes, and snippets.

View roose's full-sized avatar
🐢
Looking for a job

roose roose

🐢
Looking for a job
View GitHub Profile
@roose
roose / gist:1933047
Created February 28, 2012 15:17
Remove menu in Wordpress admin menu
<?php
function remove_menus () {
global $menu;
$restricted = array(__('Links'), __('Posts'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
@roose
roose / gist:1933052
Created February 28, 2012 15:19
Disable dashboard widgets in Wordpress Dashboard
<?php
function disable_default_dashboard_widgets() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
remove_meta_box('dashboard_plugins', 'dashboard', 'core');
remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
remove_meta_box('dashboard_primary', 'dashboard', 'core');
remove_meta_box('dashboard_secondary', 'dashboard', 'core');
@roose
roose / gist:1933129
Created February 28, 2012 15:27
Wordpress languages block(Qtranslate)
<?php
function get_qlang(){
global $q_config;
foreach(qtrans_getSortedLanguages() as $language) {
if(is_404()) $url = get_option('home'); else $url = '';
echo '<li';
if($language == $q_config['language']) echo ' class="current"';
echo '><a href="'.qtrans_convertURL($url, $language).'"';
@roose
roose / gist:2216211
Created March 27, 2012 14:11
Qtranslate. Custom Taxonomies Admin Edit Screen Fix
<?php
function qtranslate_edit_taxonomies(){
$args=array(
'public' => true ,
'_builtin' => false
);
$output = 'object'; // or objects
$operator = 'and'; // 'and' or 'or'
@roose
roose / future_core_login.php
Created May 12, 2012 15:51 — forked from franz-josef-kaiser/future_core_login.php
A WordPress plugin to build an environment to develop a single stylesheet for the login/reg/pass screen in WP 3.1
<?php
/**
* Plugin Name: Future Core Login
* Plugin URI: http://unserkaiser.com
* Description: Replacing the current stylesheets loaded on wp-login.php until this ticket goes into core: <a href="http://core.trac.wordpress.org/ticket/12506">#12506</a>
* Version: 0.1
* Author: Franz Josef Kaiser
* Author URI: http://unserkaiser.com
* License: GPL2
*
@roose
roose / support.placeholde.js
Created May 24, 2012 12:30
Cross-Browser Support for HTML5 Placeholder Text in Forms
$.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) $.support.placeholder = true;
if(!$.support.placeholder) {
var active = document.activeElement;
$(':text').focus(function () {
if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
$(this).val('').removeClass('hasPlaceholder');
}
@roose
roose / change_img_src.php
Created July 25, 2012 13:03
Change img src
<?php
//Этот фильтр меняет ссылку на файл только на морде сайта:
function change_image_src($content) {
return preg_replace('/src="([^"]+)"/', 'src="http://src.sencha.io/sw/$1"', $content);
}
add_filter( 'the_content', 'change_image_src' );
//Этот меняет ссылку на файл при сохранении/обновлении поста:
@roose
roose / jquery_plugins.md
Created February 25, 2013 06:18
Most used jQuery plugins
@roose
roose / mozlz4a.py
Created April 11, 2016 13:15 — forked from Tblue/mozlz4a.py
MozLz4a compression/decompression utility
#!/usr/bin/env python
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
# This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and
# uncompressed file size [4 bytes, little endian]).
#
# This Python 3 script requires the LZ4 bindings for Python, see: https://pypi.python.org/pypi/lz4
#
[
{
"cat": "cities",
"name": "aktau.svg"
},
{
"cat": "cities",
"name": "almaty.svg"
},
{