Skip to content

Instantly share code, notes, and snippets.

View dahnielson's full-sized avatar

Anders Dahnielson dahnielson

View GitHub Profile
@dahnielson
dahnielson / index.js
Last active May 26, 2018 20:43
Module that works directly in browser and node.js
// Check whether we are in browser or node.js
var _self = (typeof window !== 'undefined') ? window : {};
// Scoping with anonymous closure for browser
var Foo = (function(){
var _ = _self.Foo = {
init: function() {
}
}
@dahnielson
dahnielson / lcd.c
Last active July 2, 2018 09:48
I can't work out why this doesn't work properly...
#include "lcd.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
@dahnielson
dahnielson / OpenFileButton.svelte
Last active August 2, 2020 08:49
Open the file dialog in Svelte
<script>
let fileInput
</script>
<style>
input {
display: none;
}
</style>