Skip to content

Instantly share code, notes, and snippets.

@fer-ri
fer-ri / app.js
Created March 17, 2014 12:06
Cordova Phonegap Using Local Storage to Keep Application Settings
Storage.prototype.setArray = function(key, obj) {
return this.setItem(key, JSON.stringify(obj))
}
Storage.prototype.getArray = function(key) {
return JSON.parse(this.getItem(key))
}
var gatheredPosts = new Array();
// let's imagine these "posts" come from a remote data call which has just returned
@kjantzer
kjantzer / README.md
Last active April 17, 2018 13:05
Backbone.js & Underscore.js Natural Sorting

Backbone.js & Underscore.js Natural Sorting Algorithm

Backbone is great but I continually found the default sorting method limited due to the following:

Disc 1, Disc 2, … Disc 10 would become Disc 1, Disc 10, Disc 2

With the help of Jim Palmer's naturalSort.js, I was able to integrate natrual sorting into Backbone.Collection.

Backbone collections are automatically sorted and now, by simply adding sortType:"natural", your collections can be sorted naturally.

@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
function drawMouseSpeedDemo() {
var mrefreshinterval = 500; // update display every 500ms
var lastmousex=-1;
var lastmousey=-1;
var lastmousetime;
var mousetravel = 0;
var mpoints = [];
var mpoints_max = 30;
$('html').mousemove(function(e) {
var mousex = e.pageX;