Skip to content

Instantly share code, notes, and snippets.

@itsKnight847
itsKnight847 / calc.js
Created August 24, 2023 23:17
grand exchange investigator
// const item = require('./data/data.json');
const allItems = require('./data/data-hr.json');
const fs = require('fs');
let states = [];
const dir = "./data";
try {
const files = fs.readdirSync(dir);
let filesProcessed = 0;
sass --watch --sourcemap=none style.scss:style.css
@itsKnight847
itsKnight847 / js
Created September 2, 2019 16:11
fast translate
let d = '';
$('.Grayed').each(function(){
d = $(this).val().split('_').join(' ');
$(this).next().next().val(d);
$(this).next().next().keyup();
});
/**
* FCK
*/
img.fr-dii.fr-fil {
float: left;
margin: 5px 5px 5px 0;
max-width: calc(100% - 5px);
}
img.fr-dii.fr-fir {
float: right;
/**
* Google tagmanager
*/
add_action( 'wp_head', 'head_scripts' );
function head_scripts() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
@itsKnight847
itsKnight847 / functions.php - limit delete wordpress
Created May 7, 2019 07:07
prevent users from delete specific pages
add_action('wp_trash_post', 'restrict_post_deletion', 10, 1);
add_action('before_delete_post', 'restrict_post_deletion', 10, 1);
function restrict_post_deletion($post_id) {
if($post_id == 2632) wp_die('This page cannot be deleted');
}
@itsKnight847
itsKnight847 / rtl.css
Last active January 10, 2019 09:48
visual composer rtl snippet
@media screen {
/**
* rtl grid
*/
.row.rtl {
direction: rtl;
}
.row.rtl .col {
float: right;
margin-right: auto;
@itsKnight847
itsKnight847 / functions.php
Created December 26, 2018 09:22
acf init google maps in admin
function my_acf_init() {
acf_update_setting('google_api_key', 'api key here');
}
add_action('acf/init', 'my_acf_init');
@itsKnight847
itsKnight847 / htaccess
Created August 5, 2018 15:11
wordpress caching htaccess
######### CRUNCHIFY SETTING - START ##########
Options All -Indexes
# Disable ETags
<IfModule mod_headers.c>
Header unset ETag
Header set Connection keep-alive
</IfModule>
FileETag None
add the following attribute:
allow="autoplay; encrypted-media"
example:
<iframe width="100%" src="https://www.youtube.com/embed/hCgokw_cmxA?modestbranding=1&autoplay=1&showinfo=0&controls=0&playlist=hCgokw_cmxA&loop=1" allow="autoplay; encrypted-media" frameborder="0" allowfullscreen=""></iframe>