Skip to content

Instantly share code, notes, and snippets.

@svebal
svebal / gist:c48f3b2c6b50f2e669ce
Created June 26, 2014 08:45
Apache enabling gzip compression encoding with httpd.conf
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/javascript
</IfModule>
@svebal
svebal / .htaccess
Created September 21, 2015 08:02
Webfont Mime Types
# ----------------------------------------------------------------------
# Webfont access
# ----------------------------------------------------------------------
# allow access from all domains for webfonts
# alternatively you could only whitelist
# your subdomains like "sub.domain.com"
<FilesMatch "\.(ttf|otf|eot|woff|fonts.css|style.css)$">
<IfModule mod_headers.c>
@svebal
svebal / browserWidth.js
Last active July 20, 2017 08:21
display width of browser window in an element
// store wrap div in a variable
$container = $( "body" );
if ( $( "#special" ).length ) {
// element where we will display the document width
$documentWidth = $( '#curr_size' );
// display document width in the container
$documentWidth.text( $container.width() + " px" );
@svebal
svebal / mlp_navigation.php
Created July 26, 2017 09:08
Creating an own markup for MultilingualPress
<?php
/**
* Create a navigation between translated instances
*
* @param array $args {
* Optional. Array of nav menu arguments.
*
* @param string $container Whether to wrap the language switch, and what to wrap it with. Default 'div'.
* @param string $container_class Class that is applied to the container. Default 'language-switch'.
@svebal
svebal / svebal_custom_css_class.php
Last active October 10, 2017 11:51
[WordPress] adding custom css classes to body or posts
<?php
/**
* to body of one page
* https://developer.wordpress.org/reference/functions/body_class/
**/
function svebal_custom_body_class_v1( $classes ) {
if ( is_page( 'page-1' ) ) {
$classes[] = 'own-class';
}
@svebal
svebal / allow-html-in-widget-title.php
Last active October 10, 2017 19:09
[Wordpress] allow HTML tags in widget titles
<?php
// allow HTML tags in widget title
function html_widget_title( $var) {
$var = (str_replace( '[', '<', $var ));
$var = (str_replace( ']', '>', $var ));
return $var ;
}
add_filter( 'widget_title', 'html_widget_title' );
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body{
background: #fff;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body{
background: #fff;
}
@svebal
svebal / material_icons_unicode.css
Created March 4, 2018 12:03
unicodes of material icons
/*
* CSS File of Material icons.
* CSS code based on:
* https://google.github.io/material-design-icons/#icon-font-for-the-web
*/
/* Use the font
* download the font files from here: https://github.com/google/material-design-icons/tree/master/iconfont
* replace the url with your path
*/