Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
sudo apt-get install -y devilspie
mkdir -p ~/.devilspie
echo '
(if (contains (window_class) "Code")
(begin
(spawn_async (str "xprop -id " (window_xid) " -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 "))
(spawn_async (str "xprop -id " (window_xid) " -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0xD8000000"))
@vishalbasnet23
vishalbasnet23 / settings.json
Created November 25, 2019 06:18
My VSCODE Settings
{
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"editor.fontFamily": "'Victor Mono', monospace",
"editor.fontLigatures": true,
// "editor.tokenColorCustomizations": {
// "textMateRules": [{
// "scope": [
// "storage.modifier",
@vishalbasnet23
vishalbasnet23 / slider.js
Created August 19, 2018 15:52 — forked from AgencySampedro/slider.js
Facetwp - Custom slider
(function($) {
/* ======== customSlider ======== */
wp.hooks.addAction('facetwp/refresh/customSlider', function($this, facet_name) {
FWP.facets[facet_name] = [];
// settings have already been loaded
if ('undefined' !== typeof FWP.used_facets[facet_name]) {
if ('undefined' !== typeof $this.find('.facetwp-customSlider')[0].noUiSlider) {
#
# Verify captcha
$post_data = http_build_query(
array(
'secret' => CAPTCHA_SECRET,
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
)
);
$opts = array('http' =>
<?php
add_filter( 'woocommerce_bookings_in_date_range_query', 'wswp_filter_check_in_cart', 100, 1);
function wswp_filter_check_in_cart( $booking_ids ) {
foreach( $booking_ids as $key => $booking_id ) {
$booking = get_wc_booking( $booking_id );
if ( $booking->has_status( 'in-cart' ) ) {
unset( $booking_ids[$key] );
}
@vishalbasnet23
vishalbasnet23 / functions.php
Created December 4, 2017 10:35
Front-end WP Editor
<?php
function wp_editor_helper( $field ) {
$key = $field['name'];
$editor = array(
'textarea_name' => isset( $field['name'] ) ? $field['name'] : $key,
'media_buttons' => false,
'textarea_rows' => 8,
'quicktags' => false,
'tinymce' => array(
'plugins' => 'lists,paste,tabfocus,wplink,wordpress',
@vishalbasnet23
vishalbasnet23 / functions.php
Created June 19, 2017 03:17
Add filter by name to WP REST Posts End Point.
<?php
add_action( 'rest_api_init', 'rest_api_filter_add_filters' );
/**
* Add the necessary filter to each post type
**/
function rest_api_filter_add_filters() {
foreach ( get_post_types( array( 'show_in_rest' => true ), 'objects' ) as $post_type ) {
add_filter( 'rest_' . $post_type->name . '_query', 'rest_api_filter_add_filter_param', 10, 2 );
}
}
@vishalbasnet23
vishalbasnet23 / curl.php
Created May 30, 2017 10:28
Generic Curl Call PHP
<?php
function call($url,$data=array()) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
// set custom headers
$headers = array('Accept: application/json');
$headers[] = "X-Forwarded-For: {$_SERVER['REMOTE_ADDR']}";
@vishalbasnet23
vishalbasnet23 / consoleLog.js
Created April 24, 2017 11:13
Console.log tricks
/**
* Test Library on console
*/
let cdn = "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js";
let script = document.createElement('script');
script .src = cdn;
document.getElementsByTagName('head')[0].appendChild(script);
// Now Test the library methods
@vishalbasnet23
vishalbasnet23 / functions.php
Last active December 2, 2021 17:39
Append async to wp_enqueue_script
<?php
function advanced_asyc_scripts($url) {
if ( strpos( $url, '#asyncload') === false ) {
return $url;
} else if ( is_admin() ) {
return str_replace( '#asyncload', '', $url );
} else {
return str_replace( '#asyncload', '', $url )."' async='async' defer='defer";
}
}