Skip to content

Instantly share code, notes, and snippets.

View karllindmark's full-sized avatar
🎯
Focusing

Karl Lindmark karllindmark

🎯
Focusing
View GitHub Profile
@karllindmark
karllindmark / keybase.md
Created July 19, 2019 21:23
keybase.md

Keybase proof

I hereby claim:

  • I am karllindmark on github.
  • I am karllindmark (https://keybase.io/karllindmark) on keybase.
  • I have a public key ASCEeUKhxmHRuVkyAyC63f6vp8IEDkqhLmTlCHdfe4SR8go

To claim this, I am signing this object:

@karllindmark
karllindmark / index.html
Last active April 10, 2017 09:27
Chrome :first-child css bug, see relevant Fiddle: https://jsfiddle.net/2jux5kcw/
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chrome :first-child selector bug</title>
<script type="text/javascript">
var num = 0;
function addRow() {
var row = document.createElement('tr');
var row2 = document.createElement('tr');
@karllindmark
karllindmark / query_parse.php
Created December 15, 2016 10:09
Small script to parse an SQL query into an associative array
<?php
function parseQueryToArray($query) {
$twoWordChunks = array('GROUP', 'ORDER');
$twoWordChunk = '';
$joinChunks = array('LEFT', 'RIGHT', 'INNER', 'OUTER');
$joinChunk = '';
$out = array(
'SELECT' => null,
@karllindmark
karllindmark / visma-stampla_greasemonkey.js
Last active March 31, 2016 17:49
Visma Stämpla Chrome console script (quick & dirty) - worth noting is that you'll need to paste & run once every page load.
/* I'm not sure if this actually works in GreaseMonkey*, but something similar to this would be nice. */
var report = function(endDate) {
if (!endDate) {
console.error('No end date specified!');
return;
}
var interval = setInterval(function() {
if ($('#ctl00_maincontentholder_dayLabel').innerText.indexOf(endDate) !== -1) {
console.log('Found', endDate, ', exiting...');
clearInterval(interval);
@karllindmark
karllindmark / android_sanitize_filenames.py
Created February 14, 2016 23:19
Getting rid of those :nopm: files since 2016
#!/usr/bin/env python2.7
"""
This is a script to remove weird characters (currently only :) from
filenames found in the given path.
"""
import os
import subprocess
import sys
@karllindmark
karllindmark / AnimatedFloatingActionButton.java
Last active August 29, 2015 14:26
An extension of FloatingActionButton with a simple show/hide animation.
/**
* Copyright 2015 Karl Lindmark <karl@ninetwozero.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
:-)
@karllindmark
karllindmark / GridItemSpacingDecorator.java
Last active September 19, 2015 08:17
A (quick & dirty) grid item spacing decorator for the RecyclerView that enables us to have some spacing around the items.
/* Derived from http://stackoverflow.com/a/27664023/1676363 */
public class GridItemSpacingDecorator extends RecyclerView.ItemDecoration {
private final int columnCount;
private final int spaceInPixels;
public GridItemSpacingDecorator(int columnCount, int spaceInPixels) {
this.columnCount = columnCount;
this.spaceInPixels = spaceInPixels;
}