Skip to content

Instantly share code, notes, and snippets.

View RauliL's full-sized avatar

Rauli Laine RauliL

View GitHub Profile

Keybase proof

I hereby claim:

  • I am RauliL on github.
  • I am rauli (https://keybase.io/rauli) on keybase.
  • I have a public key whose fingerprint is 23EA 1B5F ACCB F21E 120C DBAD E161 8D9C 09B4 910D

To claim this, I am signing this object:

@RauliL
RauliL / ajax-setup.js
Last active January 20, 2016 11:51
Django Ajax CSRF setup.
(function() {
var matches = /(;\s*|^)csrftoken=([^;]+)/.exec(document.cookie || "");
if (matches) {
var token = decodeURIComponent(matches[2]);
$.ajaxSetup({
beforeSend: function(xhr, settings) {
// These HTTP methods do not require CSRF protection.
if (!/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type) && !this.crossDomain) {
#!/bin/sh
if test -z "${1}"
then
echo "Name of the branch missing."
exit 1
fi
if ! current_branch=`git rev-parse --abbrev-ref HEAD` 2> /dev/null
then
@RauliL
RauliL / globals.js
Last active January 20, 2016 07:41
JavaScript: Globals object.
window.Globals = (function() {
var result = {};
$("meta[name^='global:']").each(function() {
var tag = $(this);
var name = tag.attr("name").substring(7);
var content = tag.attr("content");
if (/^json:/.test(name)) {
name = name.substring(5);
@RauliL
RauliL / ie-css-limit-tester.js
Created October 30, 2015 09:12
Internet Explorer CSS rule limit tester.
(function() {
var countSheet = function(sheet) {
var count = 0;
if (!sheet || !sheet.cssRules) {
return;
}
for (var i = 0; i < sheet.cssRules.length; ++i) {
var rule = sheet.cssRules[i];
@RauliL
RauliL / iframeception.html
Created January 27, 2016 10:39
<iframe>ception
<!DOCTYPE html>
<html>
<head>
<title>iframeception</title>
<meta charset="utf-8">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 1%;
@RauliL
RauliL / class.plorth
Created August 27, 2017 16:48
Range implementation in Plorth + Class framework
: class
swap class-create swap tuck "-prototype" + tuck const " new" + compile swap
>symbol swap >word define
;
: class-extends
"prototype" swap @ nip rot "__proto__" swap ! class
;
: class-create
diff --git a/src/parse-query.js b/src/parse-query.js
index 2033083..1d7e21e 100644
--- a/src/parse-query.js
+++ b/src/parse-query.js
@@ -10,7 +10,7 @@ export const parseQuery = (query) => {
let id = null;
let className = null;
let mode = TAG_NAME;
- let buffer = '';
+ let previousOffset = 0;
@RauliL
RauliL / README.md
Created April 5, 2018 22:34
Microsoft Natural Ergonomic Keyboard 4000 settings on Ubuntu

This is just my personal setup of the Microsoft Natural Ergonomic Keyboard 4000 on Ubuntu which does various remappings that I like.

Create new file /etc/udev/hwdb.d/61-keyboard-local.hwdb and insert following there:

# Microsoft Natural Ergonomic Keyboard 4000 - remap zoom in/out to up/down
evdev:input:b0003v045Ep00DB*
 KEYBOARD_KEY_c022d=up
 KEYBOARD_KEY_c022e=down
@RauliL
RauliL / install.sh
Created September 5, 2018 16:21
Neatgear A6210 driver installation on Linux 4.15
git clone git@github.com:kaduke/Netgear-A6210.git
cd Netgear-A6210
git fetch origin port-to-4.15
git checkout port-to-4.15
make
sudo make install
# At this point you need to restart network-manager before plugging in
# the device.
sudo service network-manager restart