Skip to content

Instantly share code, notes, and snippets.

View varunsridharan's full-sized avatar
😀

Varun Sridharan varunsridharan

😀
View GitHub Profile
package com.frogsparks.mytrails.util;
import android.os.Environment;
import com.frogsparks.mytrails.MyTrails;
import java.io.File;
import java.util.*;
// http://stackoverflow.com/a/15612964/304876
@pixeline
pixeline / index.html
Last active May 26, 2019 03:44
Simple way to implement a stylesheet switcher, using jquery and proper html. Add your stylesheets to your <head> tag: <link rel="alternate stylesheet" title="red" href="css/red.css" type="text/css"> Include the jquery stylesheet switcher. Done.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<link rel="stylesheet" title="main" href="normalize.min.css" type="text/css">
<link rel="stylesheet" title="main" href="main.css" type="text/css">
<link rel="alternate stylesheet" title="red" href="red.css" type="text/css">
<link rel="alternate stylesheet" title="blue" href="blue.css" type="text/css">
@emcode
emcode / form-script.html
Created May 13, 2012 14:59
How to convert HTML form data to JS object (for using with AJAX)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>How to convert HTML form data to JS object (for using with AJAX)</title>
</head>
<body>
<form id="contact-form" action="/" method="post">
@goofball222
goofball222 / docker-compose.yml
Created November 29, 2018 23:17
Pi-Hole stack docker-compose.yml for Android Private DNS ad filtering
version: '3'
services:
dns-over-https-client:
image: goofball222/dns-over-https
container_name: dns-over-https-client
restart: unless-stopped
networks:
external:
internal:
@erlendmr
erlendmr / js-moving-from-jquery-to-vanilla-js.md
Last active September 9, 2020 11:05 — forked from liamcurry/gist:2597326
Moving from jQuery to Vanilla JS

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@zecka
zecka / vc_custom_icon_set.php
Last active October 7, 2020 08:17
Add a custom icon set from icomoon to visual composer vc_icon shortcode
<?php
// Add new custom font to Font Family selection in icon box module
function zeckart_add_new_icon_set_to_iconbox( ) {
$param = WPBMap::getParam( 'vc_icon', 'type' );
$param['value'][__( 'IcoMoon', 'total' )] = 'icomoon';
vc_update_shortcode_param( 'vc_icon', $param );
}
add_filter( 'init', 'zeckart_add_new_icon_set_to_iconbox', 40 );
@KulaGGin
KulaGGin / openInPhpStorm.bat
Created September 21, 2018 23:34
Add `Open with PhpStorm` to Windows right click context menu
@echo off
SET PhpStormPath=D:\Programs\JetBrains\PhpStorm 2018.1.6\bin\PhpStorm64.exe
echo Adding file entries
@reg add "HKEY_CLASSES_ROOT\*\shell\PhpStorm" /t REG_SZ /v "" /d "Open in PhpStorm" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\PhpStorm" /t REG_EXPAND_SZ /v "Icon" /d "%PhpStormPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\PhpStorm\command" /t REG_SZ /v "" /d "%PhpStormPath% \"%%1\"" /f
echo Adding within a folder entries
@Mikulas
Mikulas / Dockerfile
Last active March 11, 2022 12:34
Docker image PHP 7.1 alpine with extensions
FROM php:7.1-fpm-alpine
RUN apk add --update \
autoconf \
g++ \
libtool \
make \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install mysqli \
@bradvin
bradvin / get_current_post_type.php
Created March 5, 2012 18:48 — forked from mjangda/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type )
return $post->post_type;
@khromov
khromov / cart-cache-breaker.php
Last active August 14, 2022 01:39
Fixing Cart Widget showing the incorrect item when using WPML with WooCommerce, by forcing cart widget to refresh on every page load.
/** Break html5 cart caching */
add_action('wp_enqueue_scripts', 'cartcache_enqueue_scripts', 100);
function cartcache_enqueue_scripts()
{
wp_deregister_script('wc-cart-fragments');
wp_enqueue_script( 'wc-cart-fragments', get_template_directory_uri() . '/cart-fragments.js', array( 'jquery', 'jquery-cookie' ), '1.0', true );
}