Skip to content

Instantly share code, notes, and snippets.

Johan Bouveng bouveng

Block or report user

Report or block bouveng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View functions.php
$jq_integrity = 'sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=';
$jq_crossorigin = 'anonymous';
$jq_cdn = 'https://code.jquery.com/jquery-3.5.0.min.js';
$jq_version = '3.5.0';
if(! is_admin()){
function add_cdn_attrs( $tag, $handle, $src ) {
global $jq_integrity, $jq_crossorigin;
@bouveng
bouveng / functions.php
Created Apr 26, 2020
exclude pages from wp search
View functions.php
// exclude pages from wp search
if ( !is_admin() ) {
function exclude_pages( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', 'post' );
}
return $query;
}
@bouveng
bouveng / functions.php
Created Apr 15, 2020
add webp mime to wp
View functions.php
add_filter( 'upload_mimes', 'add_webp', 1, 1 );
function add_webp( $mime_types ) {
$mime_types['webp'] = 'image/webp';
return $mime_types;
}
View gist:32c5d3c71e1b061c846e065f0ddd18ea
add_action('wp_footer', 'add_partner_id');
function add_partner_id() {
echo '
<script>
( function( $ ) {
$("a[href*=\'thomann.de\']").each(function() {
$(this).attr("href", $(this).attr("href") + "?partner_id=XXXX");
});
} )( jQuery )
View gist:0f6caf34b670cd712a18
// https://jsfiddle.net/hwt3fjL1/
@keyframes txt-load {
0% {content:".";}
50% {content:"..";}
}
body {
font-size: 30px;
}
View spellcheck-helper.css
*[class*="sss"]:after {
content: "warning: css class name typo?"
color: f00;
}
@bouveng
bouveng / spinner.rb
Created Oct 29, 2015 — forked from ellemenno/spinner.rb
ascii spinner
View spinner.rb
#!/usr/bin/env ruby
# encoding: UTF-8
@dot_cycle = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']
#braille random: 0x2800 - 0x28ff
@z_arrow = ['←','↖','↑','↗','→','↘','↓','↙']
@z_b = ['b','ᓂ','q','ᓄ']
@z_d = ['d','ᓇ','p','ᓀ']
@bouveng
bouveng / asciispinner.js
Created Oct 29, 2015 — forked from stefanocudini/asciispinner.js
ascii ajax spinner, jquery
View asciispinner.js
$(function() {
var spins = [
"←↖↑↗→↘↓↙",
"▁▃▄▅▆▇█▇▆▅▄▃",
"▉▊▋▌▍▎▏▎▍▌▋▊▉",
"▖▘▝▗",
"┤┘┴└├┌┬┐",
"◢◣◤◥",
"◰ ◳ ◲ ◱",
View shader-loop.less
@base: #03203a;
@shades: 15;
.shader-loop (@i) when (@i > 0) {
.strategy-chart svg path:nth-child(@{i}) {
@inc: @i;
fill: lighten(@base, @i * 100 / @shades);
}
.shader-loop(@i - 1);
@bouveng
bouveng / gist:6ea86457738355a9ab30
Last active Aug 29, 2015
A box model that makes sense
View gist:6ea86457738355a9ab30
This is my favorite CSS addition. Before the box-sizing property, if you had an element with
a defined width of 250px and added 25px padding (both left and right) to it, the actual width
would become 300px. This always seemed strange to me and when combined with making sites
responsive, it would really become a pain in the ass. Fortunately we can now change how the
box model calculates an element’s width and height. Using box-sizing: border-box will include
the element’s border and padding when calculating the height and width of an element. Using
our previous example, an element with box-sizing: border-box applied to it with a defined
width of 250px and padding of 25px will remain 250px wide.
To apply this behavior to all of your elements, include this at the top of your stylesheet:
You can’t perform that action at this time.