Skip to content

Instantly share code, notes, and snippets.

@dciccale
dciccale / README.md
Last active October 22, 2021 21:52
Tiny Cross-browser DOM ready function in 111 bytes of JavaScript

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

@dciccale
dciccale / README.md
Last active December 9, 2015 17:49
requestAnimationFrame shim in 155 bytes (127 gzipped)

requestAnimationFrame shim

Cross-browser requestAnimationFrame in 155 bytes of JavaScript.

.vimrc.json

A demo to see how it would be to have a .vimrc with json syntax.

@dciccale
dciccale / README.md
Last active December 11, 2015 08:18
hasOwnProperty shim in 115 bytes (counting only the actual function)

hasOwnProperty shim

Cross-browser hasOwnProperty shim in 115 bytes of JavaScript.

@dciccale
dciccale / README.md
Last active December 16, 2015 06:49
Cross-browser addEvent function done with 81 bytes of JavaScript

addEvent

Cross-browser function to add events on DOM elements.

@dciccale
dciccale / README.md
Last active December 17, 2015 00:29
Cross-browser removeEvent function done with 84 bytes of JavaScript

removeEvent

Cross-browser function to remove events from DOM elements.

@dciccale
dciccale / README.md
Last active March 27, 2016 18:19
Cross-browser eventHandler function done with 270 bytes of JavaScript

eventHandler

Cross-browser function to handle DOM events.

@dciccale
dciccale / git_branch.sh
Created May 11, 2013 18:02
Bash script to get the current git branch and last commit
#!/usr/bin/env bash
# checks if branch has something pending
function parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
# gets the current git branch
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
@dciccale
dciccale / README.md
Last active May 22, 2018 09:14
Cross-browser triggerEvent function done with 127 bytes of JavaScript

triggerEvent

Cross-browser function to trigger DOM events.

@dciccale
dciccale / README.md
Last active December 22, 2015 03:49
Binary search function done with 109 bytes of JavaScript

binarySearch

Tiny binary search done with 109 bytes of JavaScript.