Skip to content

Instantly share code, notes, and snippets.

View shridharkalagi's full-sized avatar

Shridhar Kalagi shridharkalagi

  • Thoughtworks Technologies
  • Bangalore
View GitHub Profile
@mreigen
mreigen / generate-alphabets.js
Created November 20, 2017 05:55
Javascript generate alphabet string
function generateAlphabets() {
var alphabets = [];
var start = 'A'.charCodeAt(0);
var last = 'Z'.charCodeAt(0);
for (var i = start; i <= last; ++i) {
alphabets.push(String.fromCharCode(i));
}
return alphabets.join('');
}
@patik
patik / how-to-squash-commits-in-git.md
Last active October 17, 2023 02:19
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@codeguy
codeguy / slugify.js
Created September 24, 2013 13:19
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}