Skip to content

Instantly share code, notes, and snippets.

View hozefaj's full-sized avatar

Hozefa hozefaj

View GitHub Profile
@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 / 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 / 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
@zzarcon
zzarcon / fibo_loop.js
Created February 26, 2016 18:22
Fibonacci loop
function fibonacci(num){
var a = 1, b = 0, temp;
while (num >= 0){
temp = a;
a = a + b;
b = temp;
num--;
}
@zzarcon
zzarcon / fibonacci_memoization.js
Created February 17, 2016 21:17
Javascript Fibonacci memoization
function fibonacci(num, memo) {
memo = memo || {};
if (memo[num]) return memo[num];
if (num <= 1) return 1;
return memo[num] = fibonacci(num - 1, memo) + fibonacci(num - 2, memo);
}
@nepsilon
nepsilon / how-to-git-patch-diff.md
Last active August 26, 2025 16:58
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff &gt; some-changes.patch
flex-flow:column-reverse wrap-reverse;
justify-content:center;
align-content:space-between;
@isRuslan
isRuslan / index.js
Created April 1, 2015 21:44
JS: rotate array with N
/**
* Write a function that takes an array of integers
and returns that array rotated by N positions.
For example, if N=2, given the input array [1, 2, 3, 4, 5, 6]
the function should return [5, 6, 1, 2, 3, 4]
*/
var rotate = function (arr, n) {
var L = arr.length;
return arr.slice(L - n).concat(arr.slice(0, L - n));
};
@brock
brock / nodereinstall.sh
Last active March 27, 2025 16:22
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@natelandau
natelandau / .bash_profile
Last active August 12, 2025 20:16
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management