Skip to content

Instantly share code, notes, and snippets.

View gaintsev's full-sized avatar
🎯
Focusing

gaintsev gaintsev

🎯
Focusing
View GitHub Profile
@gaintsev
gaintsev / config.rb
Last active August 29, 2015 14:15
Compass config.rb example
preferred_syntax = :scss
http_path = '/'
css_dir = 'assets/styles/css'
sass_dir = 'assets/styles/scss'
images_dir = 'assets/images'
javascripts_dir = 'assets/js'
relative_assets = true
line_comments = true
# output_style = :compressed
@gaintsev
gaintsev / wp-detect-activation-plugin-error.php
Created February 24, 2015 07:16
Wordpress detect activation plugin error
add_action('activated_plugin','save_error');
function save_error(){
update_option('plugin_error', ob_get_contents());
}
echo get_option('plugin_error');
@gaintsev
gaintsev / russian-to-latin.sh
Created April 3, 2015 09:56
Transliteration of the Russian filenames
#!/bin/bash
shopt -s nullglob
for NAME in * ; do
TRS=`echo $NAME | sed "y/ абвгдезийклмнопрстуфхцы/_abvgdezijklmnoprstufxcy/"`
TRS=`echo $TRS | sed "y/ АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/_ABVGDEZIJKLMNOPRSTUFXCY/"`
TRS=${TRS//ч/ch};
TRS=${TRS//Ч/CH} TRS=${TRS//ш/sh};
TRS=${TRS//Ш/SH} TRS=${TRS//ё/jo};
TRS=${TRS//Ё/JO} TRS=${TRS//ж/zh};
@gaintsev
gaintsev / functions.php
Created May 7, 2015 09:46
Wordpress Right Way Using AJAX
//In plugin or functions.php
add_action('wp_ajax_my_action_name', 'my_action_name');
add_action('wp_ajax_nopriv_my_action_name', 'my_action_name');
function my_action_name() {
//
}
@gaintsev
gaintsev / gist:a6ab0324f99d9ccebf2e
Created June 11, 2015 20:47
Enable tracking protection in Firefox
#Get Firefox settings:
about:config
#Set as true:
privacy.trackingprotection.enabled
@gaintsev
gaintsev / _triangle.scss
Created June 12, 2015 22:20
SASS Triangle Mixin
/*
* $direction - top, right, bottom or left
* $width - arrow width
* $height - arrow height
* $color - any color
* ---
* Inspired by: http://apps.eky.hk/css-triangle-generator/
*/
@mixin triangle($direction, $width, $height, $color) {
@gaintsev
gaintsev / phpstorm.vmoptions
Created July 10, 2015 13:51
PhpStorm editor font antialiasing. Edit file my_phpstorm_location/bin/phpstorm.vmoptions or my_phpstorm_location/bin/phpstorm64.vmoptions
-server
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=150m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
@gaintsev
gaintsev / get-window-name
Created September 1, 2015 17:51
Linux get window name
xprop |awk '/WM_CLASS/{print $4}'
@gaintsev
gaintsev / wp-custom-post-capabilities.php
Created September 3, 2015 07:47
Wordpress Custom Post Type Capabilities (admin only)
<?php
function add_test_type()
{
$labels = array(
'name' => _x('Тест', 'test'),
'singular_name' => _x('Тест', 'test'),
'menu_name' => _x('Тест', 'test'),
'name_admin_bar' => _x('Тест', 'test'),
'add_new' => _x('Добавить новый', 'test'),