Skip to content

Instantly share code, notes, and snippets.

krisleech /
Last active Aug 1, 2020
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

gaearon /
Last active Jul 29, 2020
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

View Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin
$ git config master.remote origin
$ git config master.merge refs/heads/master
6174 / Random-string
Created Jul 23, 2013
Generate a random string in JavaScript In a short and fast way!
View Random-string
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
sabarasaba / gist:3080590
Created Jul 10, 2012
Remove directory from remote repository after adding them to .gitignore
View gist:3080590
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
realmyst / gist:1262561
Created Oct 4, 2011
Склонение числительных в javascript
View gist:1262561
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] ];
declOfNum(count, ['найдена', 'найдено', 'найдены']);
You can’t perform that action at this time.