Skip to content

Instantly share code, notes, and snippets.

@DenimTornado
DenimTornado / gist:6258367
Last active December 21, 2015 05:39 — forked from realmyst/gist:1262561
Склонение числительных на js
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['товар', 'товара', 'товаров']);
@DenimTornado
DenimTornado / 0_reuse_code.js
Created September 30, 2013 22:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
function lengthOf(object) {
var element_count = 0;
for (e in object) { element_count++; }
return element_count;
}
function _jqCacheSize(){return lengthOf($.cache);}
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
# disable local snapshots feature of time machine
sudo tmutil disablelocal
# undo
#sudo tmutil enablelocal
# delete all mobile backups
# repeat after every new backup drive selection
sudo rm -r /.MobileBackups