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 / multisite_functions.php
Created April 15, 2012 11:27 — forked from freekrai/multisite_functions.php
Some handy wordpress multisite functions
<?php
$posts = multisite_latest_post( array(
"how_many"=>10,
"how_long_days"=>30,
"how_many_words"=>50,
"more_text"=>"[...]",
"remove_html"=>true,
"sort_by"=>"post_date",
// if paginating:
"paginate"=>true,
@m-pokrovskii
m-pokrovskii / gist:3701539
Created September 11, 2012 19:48
CSS: Global Reset
* {
margin: 0; padding: 0;
}
@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"
}
]
@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 {
<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>
$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()'";
@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]
}
?>
@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: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 / 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>'