Skip to content

Instantly share code, notes, and snippets.

View hozefaj's full-sized avatar

Hozefa hozefaj

View GitHub Profile
@hozefaj
hozefaj / checkbox.css
Last active February 22, 2019 17:36
custom style checkboxes
// hide the native checkbox
input[type="checkbox"] {
position: absolute;
opacity: 0;
}
input[type="checkbox"] + label {
display: block;
position: relative;
padding-left: 2rem;
@hozefaj
hozefaj / delaybundle.js
Last active January 20, 2019 18:01
delay loading for react bundle
// defer loading of non-essential JS until DOM loaded event
function() {
window.addEventListener("load", function() {
var s, t;
s = document.createElement("script");
s.type = "text/javascript";
s.src =
"https://www.paypalobjects.com/digitalassets/c/website/marketing/global/kui/js/opinionLab-2.1.0.js";
t = document.getElementsByTagName("body")[0];
t.appendChild(s);
@hozefaj
hozefaj / delayImage.js
Last active January 20, 2019 05:50
defer loading image
export default class Hero extends React.Component {
state = {
showImages: false,
};
componentDidMount() {
// load images when images comes within the viewport once user starts scrolling
const domRect = this.sectionElement && this.sectionElement.getBoundingClientRect();
if (domRect && window.innerHeight - domRect.top >= 0) {
this.enableImages();
@hozefaj
hozefaj / toggle.js
Created January 18, 2019 22:19
toggle github PR review files
[...document.querySelectorAll('.js-details-target')].forEach(button => button.click());
@hozefaj
hozefaj / emoji.md
Last active October 25, 2018 18:44 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@hozefaj
hozefaj / states_hash.json
Created August 15, 2017 19:00 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@hozefaj
hozefaj / utils.js
Last active August 16, 2017 17:16
JS code to show passwords field values when filling forms
// change passwords fields into text on a web page
const nodeList = document.getElementsByTagName("input");
[...nodeList].forEach(node => {
if(node.getAttribute("type") === "password"){
node.setAttribute('type', 'text');
}
});
// wrap code within github to multiple lines
// this helps to prevent horizontal scroll
@hozefaj
hozefaj / spinner.css
Created June 23, 2016 21:34
CSS based spinner
// modifying height & width will cause various shapes to appear
.spinner {
animation: spin 0.7s infinite linear;
border-bottom: 6px solid rgba(0, 0, 0, 0.2);
border-left: 6px solid rgba(0, 0, 0, 0.2);
border-radius: 100%;
border-right: 6px solid rgba(0, 0, 0, 0.2);
border-top: 6px solid #2180c0;
content: "";
@hozefaj
hozefaj / Gruntfile.js
Created December 9, 2015 05:50
grunt task to compile base css
'use strict'
module.exports = function(grunt) {
// load all grunt tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
var dir = '/Users/hjodiawalla/Desktop/MPPContentDevelopment/MPPContent/ContentRoot/resources/',
computation = dir + 'css/base-mpp.css';
@hozefaj
hozefaj / .bash_profile
Last active April 27, 2018 19:04 — forked from natelandau/.bash_profile
bash profile for mac
export PATH=./node_modules/.bin:$PATH
alias src='source ~/.bash_profile'
#git commands
alias gc='git checkout'
alias gcc='git commit -m'
alias gs='git status'
alias ga='git add --all'
alias gp='git pull --rebase'