Skip to content

Instantly share code, notes, and snippets.

View oal's full-sized avatar

Olav Lindekleiv oal

View GitHub Profile
@oal
oal / aoe2colemak.md
Created February 7, 2021 15:06
AoE2 Definitive Edition Colemak defaults
gTile
https://extensions.gnome.org/extension/28/gtile/
Switcher
https://extensions.gnome.org/extension/973/switcher/
Dash to Panel
https://extensions.gnome.org/extension/1160/dash-to-panel/
Docker Status
@oal
oal / axios.js
Last active December 20, 2019 22:53
Quasar boot: Axios + Django Rest Framework
import axios from 'axios';
export default async ({ Vue }) => {
let axiosInstance = axios.create({
baseURL: '/api/'
});
axiosInstance.interceptors.response.use(null, error => {
if(error.response.data) {
Object.keys(error.response.data).forEach(key => {
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const {IgnorePlugin} = require('webpack');
module.exports = {
mode: 'development',
entry: [
'./resources/assets/js/app.js'
let isDev = (<any>window)['IonicDevServer'] !== undefined;
@oal
oal / lang.py
Created September 20, 2017 16:12
Quick script for extracting language strings from Laravel projects.
import re
import os
import json
from collections import OrderedDict
def extract_with(directory, before, after):
translations = {}
for root, dirs, files in os.walk(directory):
for file in files:
@oal
oal / safari-inline-footnotes.js
Created February 12, 2016 15:53
Quick and dirty userscript that inlines footnotes so I don't have to scroll to the bottom and up again.
// ==UserScript==
// @name Safari Books Online
// @namespace https://www.safaribooksonline.com/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.safaribooksonline.com/*
// @grant none
// ==/UserScript==
@oal
oal / digitize.rs
Last active August 29, 2015 14:26
Takes a number like 234908571 and returns the digits it contains as a Vec<u8>: [2, 3, 4, 9, 0, 8, 5, 7, 1]
fn digitize(n: u64) -> Vec<u8> {
let mut places = 0;
let mut ndiv = n;
while ndiv > 0 {
ndiv /= 10;
places += 1;
}
let mut digits = Vec::new();
#![feature(test)]
extern crate test;
const BOARD: &'static str = "
+---+---+---+
|375| 2 |4 9|
| |3 |1 |
|812| |7 |
+---+---+---+
| 47|2 | 3 |
fn slugify(text: &str) -> String {
// Create a mutable string to add slug characters to
let mut slug = String::with_capacity(text.len());
for c in text.chars() {
// Check if the current character is a special character, and needs to be replaced
let replacement = match c {
' ' => Some("-"),
// Scandinavian
'Æ' | 'æ' | 'Ä' | 'ä' => Some("ae"),