Skip to content

Instantly share code, notes, and snippets.

View davidcraig's full-sized avatar

David Craig davidcraig

View GitHub Profile
@davidcraig
davidcraig / 0. Initial install - error
Last active August 28, 2020 12:49
Lutris Battle.net
lutris-wrapper: Blizzard Battle.net
Running /home/david/.local/share/lutris/runners/wine/lutris-5.7-8-x86_64/bin/wine /home/david/Games/battlenet/drive_c/Program Files (x86)/Battle.net/Battle.net.exe
Initial process has started with pid 8451
Game is considered started.
Fontconfig warning: line 5: unknown element "its:rules"
Fontconfig warning: line 6: unknown element "its:translateRule"
Fontconfig error: line 6: invalid attribute 'translate'
Fontconfig error: line 6: invalid attribute 'selector'
Fontconfig error: line 7: invalid attribute 'xmlns:its'
Fontconfig error: line 7: invalid attribute 'version'
@davidcraig
davidcraig / Console (Kittens Game Script)
Last active October 18, 2020 15:33
Kittens Game script
if (!window.speed) speed = 1;
if (!game.realUpdateModel) game.realUpdateModel = game.updateModel;
game.updateModel = () => {
for (var i = 0; i < speed; i++) {
if (i !== 0) {
game.calendar.tick();
}
game.realUpdateModel();
}
}
@davidcraig
davidcraig / colours.css
Created March 16, 2019 18:58
Flat UI Colours - CSS Variables and Sass Variables
/* Flat UI Colours: https://flatuicolors.com/palette/defo */
/* CSS Variables */
:root {
/* Greens */
--flat-ui-turquoise: #1abc9c;
--flat-ui-grean-sea: #16a085;
--flat-ui-emerald: #2ecc71;
--flat-ui-nephritis: #27ae60;
@davidcraig
davidcraig / app.js
Last active April 18, 2018 08:30
VueJS Debugging: Listing registered components.
const app = new Vue({
el: '#app'
});
// Output list of components to the browser devtools.
console.log(app.$options.components);
@davidcraig
davidcraig / functions.php
Created January 23, 2018 11:36
WordPress - Remove version number from enqueued scripts/styles.
// remove wp version param from any enqueued scripts
function enqueueRemoveWpVersion($src) {
if ( strpos($src, 'ver='))
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'enqueueRemoveWpVersion', 9999 );
add_filter( 'script_loader_src', 'enqueueRemoveWpVersion', 9999 );
@davidcraig
davidcraig / verification.block
Created December 8, 2017 13:11
Blockstack.org verification
Verifying my Blockstack ID is secured with the address 19f4LPMy5SXcgPz6VcBubrkRuGZSvmvSKY https://explorer.blockstack.org/address/19f4LPMy5SXcgPz6VcBubrkRuGZSvmvSKY
@davidcraig
davidcraig / template.php
Last active July 19, 2017 08:53
Drupal 7 - Add transformed page title as a body class.
<?php
/**
* HTML template preprocessing.
*/
function MYTHEME_preprocess_html(&$variables) {
// Add the page title as a css class to allow for page specific targetting.
try {
if (!drupal_is_front_page()) {
$title = drupal_get_title();
@davidcraig
davidcraig / css.php
Created March 31, 2017 09:09
PHP: CSS Asset Pipeline
<?php
$files = [
// Insert Files Here
];
$str = '';
function combine_file_contents($filename, $str)
{
@davidcraig
davidcraig / wow-class-colors.scss
Last active December 5, 2022 16:54
SCSS: World of Warcraft: Class Colours
$wow_priest: #FFFFFF;
$wow_mage: #69CCF0;
$wow_warlock: #9482C9;
$wow_rogue: #FFF569;
$wow_druid: #FF7D0A;
$wow_monk: #00FF96;
$wow_demon_hunter: #A330C9;
$wow_hunter: #ABD473;
@davidcraig
davidcraig / countdown.php
Last active March 31, 2017 09:04
PHP: Countdown to a given date
<?php
$date = ''; // Pass in your date variable here, eg $date = '2014-09-08'
$today = new DateTime();
$to = new DateTime($date);
$countdown = $today->diff($to);
// Seperate variables for days, months, years, etc.
$seconds = $countdown->s;
$days = $countdown->d;