Skip to content

Instantly share code, notes, and snippets.

View JoniJnm's full-sized avatar

Jónatan Núñez JoniJnm

View GitHub Profile
@mudassir0909
mudassir0909 / selectize_no_results.js
Created July 24, 2014 13:56
A hacky plugin to display "No results found" message on selectize. Don't use this along with "dropdown_header" plugin though.
/*
https://github.com/brianreavis/selectize.js/issues/470
Selectize doesn't display anything to let the user know there are no results.
This is a temporary patch to display a no results option when there are no
options to select for the user.
*/
Selectize.define( 'no_results', function( options ) {
var self = this;
@epicserve
epicserve / redis_key_sizes.sh
Last active February 21, 2024 18:30
A simple script to print the size of all your Redis keys.
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}