Skip to content

Instantly share code, notes, and snippets.

View nurbakhyt's full-sized avatar
🎯
Focusing

Nurbakhyt nurbakhyt

🎯
Focusing
View GitHub Profile
@nurbakhyt
nurbakhyt / longSubstr.js
Created May 20, 2019 14:14
Find long substr in 2 strings
var str1 = "hafsa";
var str2 = "fariza";
function longSubstr(s1, s2) {
var h = {};
for (var i = 0; i < s1.length; i++) {
h[s1[i]] = [];
var idx = s2.indexOf(s1[i]);
@nurbakhyt
nurbakhyt / Undo Changes
Created October 13, 2017 18:12 — forked from warolv/Undo Changes
Undo Changes
git reset --soft HEAD^ -> undo last commit and save changes
git reset --hard HEAD~1 -> undo last commit and remove changes
git reset --hard HEAD~2 -> undo 2 last commits and remove changes
git revert commit-hash -> create new commit which reverts last commit
git checkout . -> remove all uncommitted changes
git checkout filename -> undo changes in specific file
git clear -df -> remove all untracked files
git rm filename -> remove file from index, after your did git add filename
git commit --amend -> change message of last commit
@nurbakhyt
nurbakhyt / jquery-redux-example.js
Created June 5, 2017 10:21 — forked from tzkmx/jquery-redux-example.js
Redux with jQuery simple example
// original from:https://codepen.io/mdd/pen/wGRqbw
// Reducer
const counter = (state = 0, actions) => {
switch (actions.type) {
case 'INCREMENT': return state + 1;
case 'DECREMENT': return state - 1;
default: return state
}
}