Skip to content

Instantly share code, notes, and snippets.

Avatar

Hozefa hozefaj

View GitHub Profile
@hozefaj
hozefaj / checkbox.css
Last active Feb 22, 2019
custom style checkboxes
View checkbox.css
// 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 Jan 20, 2019
delay loading for react bundle
View delaybundle.js
// 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 Jan 20, 2019
defer loading image
View delayImage.js
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 Jan 18, 2019
toggle github PR review files
View toggle.js
[...document.querySelectorAll('.js-details-target')].forEach(button => button.click());
@hozefaj
hozefaj / emoji.md
Last active Oct 25, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View emoji.md

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 Aug 15, 2017 — forked from mshafrir/states_hash.json
US states in JSON form
View states_hash.json
{
"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 Aug 16, 2017
JS code to show passwords field values when filling forms
View utils.js
// 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 Jun 23, 2016
CSS based spinner
View spinner.css
// 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 Dec 9, 2015
grunt task to compile base css
View Gruntfile.js
'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 Apr 27, 2018 — forked from natelandau/.bash_profile
bash profile for mac
View .bash_profile
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'