Skip to content

Instantly share code, notes, and snippets.

View gbhasha's full-sized avatar

Galeel Bhasha Satthar gbhasha

View GitHub Profile
@gbhasha
gbhasha / gitconfig
Created September 12, 2017 06:17
Load user level git config based on the working folder
# put below code in ~/.gitconfig
[includeIf "gitdir:~/Projects/personal/"]
path = ~/.gitconfig-personal
[includeIf "gitdir:~/Projects/project1/"]
path = ~/.gitconfig-project1
[includeIf "gitdir:~/Projects/project2/"]
path = ~/.gitconfig-project1
# put below code in ~/.gitconfig-project1
[user]
@gbhasha
gbhasha / config
Created September 12, 2017 06:13
Load ssh keys based on the GitHub host
# Put below code in ~/.ssh/config
# Default GitHub
Host github.com
ForwardAgent yes
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
# private GitHub
Host github.orgname.com
HostName github.orgname.com
@gbhasha
gbhasha / objectComparison.js
Created November 26, 2016 03:24 — forked from nesbtesh/objectComparison.js
Object comparison JS
export const isObjectEqual = (obj1, obj2) => {
if(!isObject(obj1) || !isObject(obj2)) {
return false;
}
if (obj1 === obj2) {
return true;
}
const item1Keys = Object.keys(obj1).sort();
var object1 = {color: "blue", size: 12};
var object2 = object1
object2.color = "red"
object1 === object2 //true
object3 = Object.assign({}, object1)
object3.color = "red"
object1 === object3 //false
function es6BindAll(context, methodNames) {
methodNames.map(function(methodName) {
context[methodName] = context[methodName].bind(context);
});
};
// Usage:
// es6BindAll(this, ["method1", "method2", "methodX"]);
@gbhasha
gbhasha / index.html
Created September 5, 2016 22:37 — forked from anonymous/index.html
JS Bin ReactJS Template / Sandbox // source http://jsbin.com/fibofo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="ReactJS Template / Sandbox">
<script src="https://fb.me/react-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
li {list-style:none}
@gbhasha
gbhasha / index.html
Created September 5, 2016 22:37 — forked from anonymous/index.html
JS Bin ReactJS Template / Sandbox // source http://jsbin.com/mutize
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="ReactJS Template / Sandbox">
<script src="https://fb.me/react-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
li {list-style:none}
function color_meter(cwith, ccolor) {
if (!cwith && !ccolor) return;
var _cwith = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith;
var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor;
var _r = parseInt(_cwith.substring(0,2), 16);
var _g = parseInt(_cwith.substring(2,4), 16);
var _b = parseInt(_cwith.substring(4,6), 16);
/*
* a small mixin for easy use of rem. Only for modern browsers. (No px as fallback)
* for px fallback refer: https://gist.github.com/gbhasha/938a17d5f83a78f56da7
* usage: @include to-rem(font-size, 14px)
* usage: @include to-rem(marign, 0 12px 2 1.2)
* usage: @include to-rem(padding, 1.5 24px)
*
*/
@mixin to-rem($property, $values) {
// Create a list as output buffer.
/*
* a small mixin for easy use of rem with px as fallback
* usage: @include x-rem(font-size, 14px)
* usage: @include x-rem(marign, 0 12px 2 1.2)
* usage: @include x-rem(padding, 1.5 24px)
*
*/
@mixin x-rem($property, $values) {
// Create a couple of empty lists as output buffers.
$base-font-size: 16px; // should be consistent with your html/body font-size