Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am LokeCarlsson on github.
  • I am lokecarlsson (https://keybase.io/lokecarlsson) on keybase.
  • I have a public key whose fingerprint is 8510 FEAC 9997 73DF 60F6 36FD 87E4 C9D5 EF34 610C

To claim this, I am signing this object:

@loke-dev
loke-dev / default.conf
Created March 13, 2017 18:16
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80;
root /your/root/path;
index index.html;
server_name you.server.com;
location / {
@loke-dev
loke-dev / eddystone.js
Last active March 15, 2017 12:54
Eddystone bluetooth beacon for node.js
const eddystoneBeacon = require('eddystone-beacon')
const options = {
name: 'Beacon', // set device name when advertising (Linux only)
txPowerLevel: -21, // override TX Power Level, default value is -21,
tlmCount: 2, // 2 TLM frames
tlmPeriod: 10 // every 10 advertisements
}
eddystoneBeacon.advertiseUrl('https://lnu.se', options)
@loke-dev
loke-dev / gist:7dd4d6b4b9fa527a3343d83b4d9c534c
Created October 20, 2017 11:42
Heap sort benchmark test
var a = randomArray(100000, 100000);
function randomArray(length, max) {
return Array.apply(null, Array(length)).map(function() {
return Math.round(Math.random() * max);
});
}
function swap(a, i, j) {
var tmp = a[i];
var a = randomArray(11, 11);
function randomArray(length, max) {
return Array.apply(null, Array(length)).map(function() {
return Math.round(Math.random() * max);
});
}
shuffle = function(v) {
for(var j, x, i = v.length; i; j = Math.floor(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x);
@loke-dev
loke-dev / eduroam-linux-lnu.sh
Created November 14, 2017 08:47
eduroam-linux-lnu
#!/usr/bin/env bash
if [ -z "$BASH" ] ; then
bash $0
exit
fi
my_name=$0
_extractSummary(events, keys) {
const extract = () => keys.reduce((obj, key) => (obj[key]=events[key], obj), {})
return keys.map(e => ({ type: e, value: extract(events, keys)[e] }));
}
#!/usr/bin/env python
import sys, os, re
from subprocess import check_output
from contextlib import closing
import urllib2
import json
commit_msg_filepath = sys.argv[1]
joke = ""
{
"basics": {
"name": "Loke Carlsson",
"picture": "https://loke.dev/loke-profile.png",
"label": "Web developer",
"headline": "Loke Carlsson resume",
"summary": "I am a tech interested problem solver, both in everyday life and professionally. On my spare time I like to do all kind of stuff, from painting, riding my mountain bike to tinker with home automation. I enjoy finding ways to improve, either personally by learning a new practical skill or finding a better way to build better websites. \n\n I enjoy explore different toolings such as React or Vue ecosystems that helps developers create awesome experiences, when doing pet projects in my spare time. Everything from creating a starter project for other people to use to creating an ecommerce site for a friend. I find pleasure in building stuff that can be seen and used, and making sure the user have a great experience.",
"website": "https://loke.dev",
"username": "lokecarlsson",
"email": "[email protected]",
@loke-dev
loke-dev / gist:1154b8a00ff69997fec6cbb2167b0fa6
Last active November 5, 2021 13:53
Vscode - search and replace with wildcard
// Search for:
breakpoint\("([a-zA-Z]*)?"\s*(\) - 1px)
// Replace with:
(breakpoint("$1") - 1px)
// Will produce the following change:
@media (max-width: breakpoint("tiny") - 1px) {
@media (max-width: (breakpoint("tiny") - 1px)) {