Skip to content

Instantly share code, notes, and snippets.

View gbhasha's full-sized avatar

Galeel Bhasha Satthar gbhasha

View GitHub Profile
@gbhasha
gbhasha / .zshrc
Created August 31, 2020 14:17 — forked from majgis/.zshrc
automatically call nvm use if .nvmrc is present
# Taken from here:
# https://github.com/creationix/nvm#zsh
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
@gbhasha
gbhasha / has-own-property.js
Created October 3, 2018 11:25 — forked from quisido/has-own-property.js
Object.prototype.hasOwnProperty.call
const myObject = Object.create(null);
myObject; // {}
myObject.test; // undefined
Object.prototype.hasOwnProperty.call(myObject, 'test'); // false
// Uncaught TypeError:
// myObject.hasOwnProperty is not a function
myObject.hasOwnProperty('test');
@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
@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 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