Skip to content

Instantly share code, notes, and snippets.

View matijs's full-sized avatar
:dependabot:
Scouting turtles

matijs matijs

:dependabot:
Scouting turtles
View GitHub Profile
@matijs
matijs / click-handler.js
Last active August 29, 2015 14:09
jQuery-based method for handling clicks declared with a data-attribute
$(function() {
'use strict';
// generic click handler
$(document).on('click', '[data-handler]', function(event) {
var handler = this.getAttribute('data-handler');
// honour default behaviour when using modifier keys when clicking
// for example:
// cmd + click / ctrl + click opens a link in a new tab
// shift + click opens a link in a new window
if (this.tagName === 'A' && (event.metaKey || event.ctrlKey || event.shiftKey)) {
/*
* How to get the scrolling element in charge of scrolling the viewport:
*
* - in Quirks mode the scrolling element is the "body"
* - in Standard mode the scrolling element is the "documentElement"
*
* webkit based browsers always use the "body" element disrespectfull of the specifications:
* http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop
*/
function getScrollingElement() {
@matijs
matijs / hasTransforms.js
Created August 6, 2014 13:26
feature detect css transforms
var hasTransforms = (function() {
var propNames = ["transform", "MozTransform", "webkitTransform", "msTransform"];
var i = 0;
var length = propNames.length;
for (; i < length; i++) {
if (typeof document.documentElement.style[propNames[i]] === "string") return true;
}
return false;
}());
@matijs
matijs / sitemap.xml
Created July 11, 2014 15:14
Jekyll sitemap
---
layout: none
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}{% unless post.unpublished == false %}<url>
<loc>{{ site.url }}{{ post.url }}</loc>
<lastmod>{% if post.sitemap.lastmod %}{{ post.sitemap.lastmod | date: "%Y-%m-%d" }}{% else %}{{ post.date | date_to_xmlschema }}{% endif %}</lastmod>{% if post.sitemap.changefreq %}
<changefreq>{{ post.sitemap.changefreq }}</changefreq>{% endif %}{% if post.sitemap.priority %}
<priority>{{ post.sitemap.priority }}</priority>{% endif %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Overlay modals</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="overlay align-top">

Keybase proof

I hereby claim:

  • I am matijs on github.
  • I am matijs (https://keybase.io/matijs) on keybase.
  • I have a public key whose fingerprint is F561 2602 AC9A 189A 0894 19D2 1D57 5FD0 310D EF84

To claim this, I am signing this object:

@matijs
matijs / README.md
Last active April 12, 2023 22:24
Resizing a partition and filesystem on a headless Raspberry Pi running Arch Linux using a USB drive

Resizing a partition and filesystem on a headless Raspberry Pi running Arch Linux using a USB drive

disclaimer: this worked for me, your mileage may vary. Your Pi, your responsibility :)

After putting Arch Linux on a 16GB SD card using these instructions, I ended up with about 14GB of free space.

Arch Linux uses one primary partition (/dev/mmcblk0p1) and an extended partition (/dev/mmcblk0p2) containing one logical partition (/dev/mmcblk0p5). The primary partition is the boot partition and the logical partition is the root partition. Rather than adding another primary partition I just wanted to resize the root partition and filesystem.

According to this bugreport parted no longer handles resizing of partitions and gparted needs a graphical environment to run. So I had to come up with something else to resize my partitions.

@matijs
matijs / postforms.js
Last active August 29, 2015 13:57 — forked from adactio/postforms.js
/*
Show a progress element for any form submission via POST.
Prevent the form element from being submitted twice.
*/
(function ( win, doc ) {
'use strict';
if ( !win.addEventListener ) {
// doesn't cut the mustard.
return;
}
@matijs
matijs / README.md
Last active June 13, 2019 09:03
Instructions and example configuration to install BitTorrent Sync on a Raspberry Pi running Arch Linux.

Installing BitTorrent Sync on a Raspberry Pi running Arch Linux

The commands below assume you're using a user that can use sudo, you're not logged in as root are you!?

First create a btsync user:

sudo useradd -M --shell /bin/false --home /var/lib/btsync
@matijs
matijs / scrollbarsize.js
Last active December 30, 2015 21:39
calculate the size of the scrollbar
var scrollbarSize = (function() {
var inner = document.createElement( "div" ),
outer = document.createElement( "div" );
inner.style.width = "100%";
inner.style.height = "60px";
outer.style.position = "absolute";
outer.style.top = "0";
outer.style.left = "0";
outer.style.visibility = "hidden";
outer.style.width = "50px";