Skip to content

Instantly share code, notes, and snippets.

View m-pokrovskii's full-sized avatar

Maxim Pokrovskii m-pokrovskii

View GitHub Profile
@m-pokrovskii
m-pokrovskii / css.css
Created September 14, 2013 04:26
Add a Link Around an Embedded Flash File
.flash-wrap{
position: relative;
}
.flash-link{
position: absolute; top:0px; left:0px;
width:180px; /*Flash Size*/
height:220px;
/*background: url('images/0.gif') no-repeat;*/ /*You should uncommented this line for support old IE version.*/
}
@m-pokrovskii
m-pokrovskii / index.php
Created September 6, 2013 17:00
Wordpress.Redirect all pages to home for non-authorized users
if (!current_user_can('edit_others_posts')) {
$redirect_to = get_option('home');
wp_redirect($redirect_to,302);
}
@m-pokrovskii
m-pokrovskii / admin.js
Created September 3, 2013 00:14
Wordpress. Change date by bulk edit action
(function($){
$('#bulk-edit .inline-edit-col-right .inline-edit-col')
.append(
'<label><span class="title">Date</span></label>'
+'<div class="inline-edit-date">'
+'<div class="timestamp-wrap"><select name="mm">'
+'<option value="00">Select</option>'
+'<option value="01">01-Jan</option>'
+'<option value="02">02-Feb</option>'
+'<option value="03">03-Mar</option>'
@m-pokrovskii
m-pokrovskii / gist:6251224
Created August 16, 2013 16:09
alias for runing google chrome on mac with attribute "--allow-file-access-from-files"
alias chrome-local='open /Applications/Google\ Chrome.app --args --allow-file-access-from-files'
@m-pokrovskii
m-pokrovskii / .htaccess
Created July 24, 2013 16:07
[Wordpress] How to change permalink structure (/%post_id%) and save old
RedirectMatch 301 ^/(\d+)$ http://sitename.com/?p=$1
@m-pokrovskii
m-pokrovskii / gist:4962913
Last active December 13, 2015 19:28
How to get text before <!-- more -->
<?php
if( strpos($post->post_content, '<!--more-->') ) {
preg_match ('/(.*)<!--more-->/s', $post->post_content, $match);
echo $match[0]
}
?>
$fql = "SELECT url, normalized_url, share_count, like_count, comment_count, ";
$fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM ";
$fql .= "link_stat WHERE url = 'the_permalink()'";
<div class="search__checkboxes">
<span class="input checkbox checked"></span>
<span class="label-ceckbox">Label 1</span>
<span class="input checkbox"></span>
<span class="label-ceckbox">Label 2</span>
</div>
@m-pokrovskii
m-pokrovskii / gist:4348332
Created December 20, 2012 20:35
tmp. Add checkboxes
.search__checkboxes {
margin-top: 10px;
margin-left: 10px;
overflow: hidden;
}
.search__checkboxes .input.checkbox {
}
.label-ceckbox {
@m-pokrovskii
m-pokrovskii / Default (OSX).sublime-keymap
Created November 10, 2012 17:04
bracket is sublime
[
{ "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{\n\t$0\n\t}"}, "context":
[
{
"operand": "source.css - source.css.embedded, source.css.embedded.html",
"operator": "equal",
"match_all": true,
"key": "selector"
}
]