Skip to content

Instantly share code, notes, and snippets.

View Firsh's full-sized avatar

Firsh Firsh

View GitHub Profile
@Firsh
Firsh / Old_badges.user.js
Last active August 29, 2015 14:05
Userscript: Old badges on Envato Market
// ==UserScript==
// @name Old badges on Envato Market
// @include http://themeforest.net*
// @include http://codecanyon.net*
// @include http://videohive.net*
// @include http://audiojungle.net*
// @include http://graphicriver.net*
// @include http://photodune.net*
// @include http://3docean.net*
// @include http://activeden.net*
@Firsh
Firsh / Hide_new_badges.user.css
Last active August 29, 2015 14:05
Userstyle: Hide new badges on Envato Market page load
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("themeforest.net"),domain("codecanyon.net"),domain("videohive.net"),domain("audiojungle.net"),domain("graphicriver.net"),domain("photodune.net"),domain("3docean.net"),domain("activeden.net") {
/* Disable new badges */
/* Author: Firsh */
/* The purpose of this file is to disable new badges so they don't flash until they are treated by the userscript. */
.community-badges__badge--s,
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
@Firsh
Firsh / jig_detect_ngg_tag
Created June 5, 2015 10:49
Upcoming fix
function jig_detect_ngg_tag($content){
global $post;
if($post->post_name == 'ngg_tag'){
if(preg_match('/ngg_images.*source.*tags.*slug=\'([^\'"]*)\'.*photocrati-nextgen_basic_thumbnails/i', $content, $groups)){
$tag = $groups[1];
$content = "[justified_image_grid ng_tags_gallery={$tag}]";
}else{ // legacy
preg_match_all('/(?<=data-image-id=")(\d+)(?=")/im', $content, $result, PREG_PATTERN_ORDER);
$ids = implode(',',$result[0]);
if(!empty($ids)){
@Firsh
Firsh / a.txt
Created August 18, 2015 12:06
All hooks version A/B
>>>>> Ultimate_GetBoxShadow
10 (object) Ultimate_BoxShadow -> ultimate_get_box_shadow (3)
>>>>> WPML_PT_HTML
101 (object) WPML_Package_Translation_HTML_Packages -> loaded (1)
>>>>> WPML_ST_strings_context_language
10 (object) WPML_String_Translation -> get_default_context_language (2)
>>>>> WPML_ST_strings_language
10 (object) WPML_String_Translation -> get_strings_language (1)
>>>>> WPML_current_user
10 (object) SitePress -> get_current_user (0)
@Firsh
Firsh / jig-jQuery-v3-hack.js
Created July 7, 2016 18:47
jQuery v3 compatibility hack against jQuery easing v1.3
// jQuery v3 *requires* easing functions in this new format..
// if the site uses old (pre-v1.4) jQuery easing plugins, animations don't work, hence the need to create JIG's own
// jQuery v1-v2 uses the new format but is fine with the legacy format too..
$.extend( $.easing, {
// opacity changes and fades are fine with swing
JIGswing: function(p) {
return 0.5 - Math.cos(p*Math.PI)/2;
},
// for 2D movements
JIGeaseInOutQuad: function(x) {
@Firsh
Firsh / index-with-search.php
Created August 9, 2016 19:34
For meravjon
<?php
if (is_search()) {
if (array_key_exists('s', $wp->query_vars) && !empty($wp->query_vars['s'])) {
$the_search_query = $wp->query_vars['s'];
get_jig(array(
'preset' => '19',
'row_height' => '250',
'orderby' => 'title_asc',
'ng_intersect_tags' => 'yes',
'ng_search_options' => 'tag',
@Firsh
Firsh / dummy-rss.xml
Created September 24, 2016 10:44
How to add any image to JIG
<?xml version="1.0" ?>
<rss version="2.0">
<channel>
<title>Title of the test feed</title>
<description>To get external images to JIG</description>
<link>http://justifiedgrid.com/</link>
<item>
<title>The first photo</title>
<description><![CDATA[
<img src="http://dummyimage.com/600x600/3e2723/ff5722/&text=Dummy photo" />
@Firsh
Firsh / selective-loader.php
Created June 6, 2017 16:18
Disable x plugin when not needed
<?php
// http://wordpress.stackexchange.com/questions/114345/load-plugin-selectively-for-pages-or-posts-etc
// http://codex.wordpress.org/Must_Use_Plugins
add_filter( 'option_active_plugins', 'enable_plugins_selectively' );
function enable_plugins_selectively( $plugins ) {
// Dont' mess with the plugins if it's the admin, yo
//if(is_admin() || stripos($_SERVER["SCRIPT_NAME"], strrchr(wp_login_url(), '/')) !== false){
$ sudo phpbrew install php-7.2.1 +default +dbs +mb +iconv +apxs2=/usr/bin/apxs2
*WARNING* You're runing phpbrew as root/sudo. Unless you're going to install
system-wide phpbrew or this might cause problems.
===> phpbrew will now build 7.2.1
===> Loading and resolving variants...
Downloading http://www.php.net/get/php-7.2.1.tar.bz2/from/this/mirror via curl extension
Redirecting to http://be2.php.net/distributions/php-7.2.1.tar.bz2
[==================================================================] 14.29/14.29MB 100%
===> Extracting /home/ubuntu/.phpbrew/distfiles/php-7.2.1.tar.bz2 to /home/ubuntu/.phpbrew/build/tmp.1517140904/php-7.2.1
===> Moving /home/ubuntu/.phpbrew/build/tmp.1517140904/php-7.2.1 to /home/ubuntu/.phpbrew/build/php-7.2.1