Skip to content

Instantly share code, notes, and snippets.

View khromov's full-sized avatar

Stanislav Khromov khromov

View GitHub Profile
@khromov
khromov / wp-users-media.php
Created May 16, 2014 09:44
wp-users-media.php Plugin
<?php
/**
* Plugin Name: WP Users Media
* Plugin URI: http://www.wknet.com/wp-users-media/
* Description: WP Users Media is a WordPress plugin that displays only the current users media files and attachments in WP Admin.
* Version: 1.0.3
* Author: Damir Calusic
* Author URI: http://www.damircalusic.com/
* License: GPLv2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@khromov
khromov / limit-author-view-scope.php
Created May 28, 2014 15:22
Limit author view scope WordPress
<?php
/*
Plugin Name: Limit Author View scope
Plugin URI:
Description: Limits non-admins to only see their own media and comments.
Version: 2014.05.28
Author: khromov
Author URI: https://profiles.wordpress.org/khromov
License: GPL2
*/
@khromov
khromov / xss.js
Created September 16, 2014 12:59
XSS example
lol</span><script>alert(1);</script>
@khromov
khromov / isMobile.js
Created October 2, 2014 13:23
Mobile detection
/*
* Tiny mobile detection script, courtesy of
* https://github.com/markdalgleish/stellar.js/issues/37
*/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
@khromov
khromov / keybase.md
Created October 14, 2014 20:09
keybase.md

Keybase proof

I hereby claim:

  • I am khromov on github.
  • I am khromov (https://keybase.io/khromov) on keybase.
  • I have a public key whose fingerprint is 8A0D 8C75 FCCE FACE 4053 88C5 8F7D 1DB4 F63C 1D5C

To claim this, I am signing this object:

@khromov
khromov / dfp-head.html
Last active August 29, 2015 14:08
dfp-head.html
<!-- IDG DFP wp_head -->
<script type="text/javascript">
var gptadslots = [];
/* Only load ads on the initial page load, although enquire may try to run the again if user resizes their window */
var dfpIsInitialPageLoad = true;
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
var dfpUnitName = "<?=$DFP_UNIT_NAME?>";
@khromov
khromov / acf-create.php
Created November 4, 2014 12:42
ACF PRO create post on frontend
<?php
acf_form(array(
'id' => 'your-form',
'post_id' => 'new_post',
'new_post' => array(
'post_type' => 'post',
'post_status' => 'publish',
'post_author' => get_current_user_id()
),
'field_groups' => array('group_544f441dc5661', 'group_544f49a3060b0', 'group_5451dc41933e4'), //Your ACF groups
$tmp = function() {
?>
<?php
};
@khromov
khromov / capital_p_dangit_perf.php
Last active August 29, 2015 14:13
capital_P_dangit performance impact tester
<?php
/*
Plugin Name: capital_P_dangit performance test
Plugin URI:
Description: Use shortcode on any page: [capital_P_dangit_performance count="10000"]
Version: 1.0
Author: khromov
Author URI: http://snippets.khromov.se
License: GPL2
*/
<?php
/*
Plugin Name: Your Plugin
Plugin URI: http://snippets.khromov.se/a-nicer-way-to-structure-your-plugin/
Description: Your plugin skeleton
Version: 1.0
Author: you
Author URI: http://your-site.com
License: GPL2
*/