Skip to content

Instantly share code, notes, and snippets.

@taneltm
taneltm / hasStorage.js
Last active August 29, 2015 14:06
Check for localStorage
/**
* This tests if the localStorage is available or not.
* Alternatively, you can check how modernizr does it:
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js
*
* If you check just (typeof window.Storage != "undefined"),
* it will not detect if the user is allowing localStorage or not.
*
* If you check (typeof window.localStorage != "undefined"),
* it will throw a SecurityException if the user has disallowed localStorage.
@taneltm
taneltm / HistoryMan.js
Created September 21, 2014 13:14
History manager
/**
* History manager.
*
* It can be used to keep track of application state.
* Can be used in places where an Undo/Redo framework doesn't quite fit.
*
* Can be used with Node.js or as a RequireJS modle.
*
* @version 0.0.1
* @author TanelTM
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
(function() {
var isDeviceReady = false;
var onDeviceReady = function() {
console.log('whenDeviceReady:onDeviceReady')
isDeviceReady = true
};
javascript:(function(){var queryString='?reload='+new Date().getTime();$('link[rel="stylesheet"]').each(function(){this.href=this.href.replace(/\?.*|$/, queryString);})})();
@taneltm
taneltm / password-card.markdown
Last active July 3, 2017 08:19
Password card
@taneltm
taneltm / diagonal-traverse.js
Created September 25, 2019 20:40
Diagonal traverse
// Initial test data
var data = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
// First time this function is executed with just the input argument
// The input argument always has the test data and it doesn't change
//
@taneltm
taneltm / README.md
Last active October 31, 2024 14:19
Markdown headings github test

Table of Contents

Hello

Hello world!

@taneltm
taneltm / obsidian-markdown-print-example.md
Created February 2, 2022 21:41
Obsidian markdown print example

h1 Heading

h2 Heading

h3 Heading

h4 Heading

h5 Heading
h6 Heading

This is bold text This is italic text Strikethrough

@taneltm
taneltm / README.md
Last active April 12, 2024 08:47
Obsidian timeline CSS snippet

Obsidian timeline

This is a CSS snippet for Obsidian.md to create a timeline in your daily notes.

To include the timeline in your daily note, add the following to your daily note template:

<div data-timeline="{{date:DDD}}"></div>

Preview can be found here: https://codepen.io/taneltm/pen/eYyeyBe