Skip to content

Instantly share code, notes, and snippets.

Johan Bouveng bouveng

View GitHub Profile
View CheepCheep.js
import Entity from '../Entity.js';
import Trait from '../Trait.js';
import Killable from '../traits/Killable.js';
import {loadSpriteSheet} from '../loaders/sprite.js';
export function loadCheepSlow() {
return loadSpriteSheet('cheep-gray')
.then(createCheepSlowFactory);
}
View .htaccess
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|webp|svg|gif|woff|woff2|js|css)$">
Header set Cache-Control "max-age=31536000, public"
Header append Vary: Accept-Encoding
Header set Access-Control-Allow-Origin “*”
</filesMatch>
<ifmodule mod_deflate.c>
<ifmodule mod_mime.c>
AddType application/x-font-ttf .ttf
AddType application/font-woff .woff
View position.js
function createTileCandidateLayer(tileResolver) {
const resolvedTiles = [];
const tileSize = tileResolver.tileSize;
const getByIndexOriginal = tileResolver.getByIndex;
tileResolver.getByIndex = function getByIndexFake(x, y) {
resolvedTiles.push({x, y});
return getByIndexOriginal.call(tileResolver, x, y);
}
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','ᓀ']
You can’t perform that action at this time.