Skip to content

Instantly share code, notes, and snippets.

View ramesaliyev's full-sized avatar
🏇
Learn, Do, Sleep, Repeat.

Rameş Aliyev ramesaliyev

🏇
Learn, Do, Sleep, Repeat.
View GitHub Profile
@ramesaliyev
ramesaliyev / backboneHandlebarsDynamicRender.html
Last active November 3, 2020 00:52 — forked from kyleondata/gist:3440492
Backbone-Handlebars Dynamic Render
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="jquery-1.9.0.js" ></script>
<script src="handlebars-1.0.rc.2.js" ></script>
<script src="underscore-1.4.4.js" ></script>
<script src="backbone-0.9.10.js" ></script>
@ramesaliyev
ramesaliyev / returnExportsGlobal.hbs
Last active February 11, 2024 22:28
Grunt UMD returnExportsGlobal Template
{{!--
Uses Node, AMD or browser globals to create a module. This example creates
a global even when AMD is used. This is useful if you have some scripts
that are loaded by an AMD loader, but they still want access to globals.
If you do not need to export a global for the AMD case,
see returnExports.js.
If you want something that will work in other stricter CommonJS environments,
or if you need to create a circular dependency, see commonJsStrictGlobal.js
@ramesaliyev
ramesaliyev / Git Cheat Sheet
Last active October 23, 2019 12:18
Git Cheat Sheet
- Create a repository
git init <repo-name>
git clone <url> <directory-name>
git clone -o <remote-name> <url>
- Commiting
git add <filename>
git commit -m "Commit Message"
git commit -am "Commit Message"
git commit --amend --date="now"
@ramesaliyev
ramesaliyev / isVersionNewer.js
Last active October 10, 2015 09:22
JavaScript Version Script Comparison
/**
* if v2 version value bigger than v1, returns true. otherwise returns false.
*
* Version part lengths should be equal.
*
* Examples:
* isVersionNewer('1', '2'); -> true
* isVersionNewer('1.0', '2.0'); -> true
* isVersionNewer('2.0.1', '2.0.0'); -> false
* isVersionNewer('3.2.1.0', '3.2.1.1'); -> true
@ramesaliyev
ramesaliyev / destructuring.js
Created October 23, 2015 08:12 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring.
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@ramesaliyev
ramesaliyev / mongodb-auth.sh
Created April 17, 2016 11:24 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@ramesaliyev
ramesaliyev / react-lifecycle.js
Created March 29, 2017 10:41
React.js Lifecycle Events
// Invoked once before first render
componentWillMount() {
console.log('componentWillMount');
// Calling setState here does not cause a re-render
}
// Invoked once after the first render
componentDidMount(){
console.log('componentDidMount');
}
@ramesaliyev
ramesaliyev / bash_renamer.sh
Created May 28, 2018 10:20
Simple scripts for rename bulk files with bash.
for file in ADA202_*.pdf
do
mv "$file" "${file/ADA202_/}"
done
@ramesaliyev
ramesaliyev / docker-purge-everything.sh
Created August 23, 2018 13:43
Remove everything from docker.
# This will;
# - stop every container
# - remove every container
# - remove every image
# - remove every network
# - remove every volume
$(docker stop -f $(docker ps -aq)) /
$(docker rm -f $(docker ps -aq)) /
$(docker rmi -f $(docker images -aq)) /
@ramesaliyev
ramesaliyev / kilp.sh
Created August 25, 2018 07:24
Kill process listening on port
# Simply Add this into your .bashrc or .zshrc or something.
# Reload bash and then;
# kilp 7070
function kilp() {
kill -9 $(lsof -ti tcp:$1)
}