Skip to content

Instantly share code, notes, and snippets.

@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 / reset.css
Created May 18, 2011 13:09
One-line CSS Reset
*{margin:0;padding:0;outline:0;font-size:1em;font-weight:normal;font-style:normal;border:0;text-decoration:none;list-style-type:none}
@dciccale
dciccale / docker-enter
Last active March 30, 2022 16:48
docker-enter bash alias to enter a docker container
# usage docker-enter [CONTAINER_ID]
dockerenter() {
docker exec -it $1 bash
}
alias docker-enter=dockerenter
@dciccale
dciccale / .bashrc
Created February 9, 2022 18:58
bash alias to open a pull request on github
pr() {
local _open=$(if [[ `uname -s` == "Linux" ]]; then echo "xdg-open"; else echo "open"; fi)
local repo=`git config --get remote.origin.url | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git rev-parse --abbrev-ref HEAD`
$_open https://github.com/$repo/pull/new/$branch
}
@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 / demo.html
Last active January 22, 2021 10:40
Styling radios & checkboxes using CSS3 (only for webkit)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Styling radios &amp; checkboxes using CSS3</title>
<link rel="stylesheet" media="screen" href="styles.css" >
</head>
<body>
<h1>Styling radios &amp; checkboxes using CSS3</h1>
@dciccale
dciccale / LICENSE.txt
Created July 31, 2011 09:30 — forked from 140bytes/LICENSE.txt
Detect if Flash Player is installed in your browser (120bytes)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Denis Ciccale <http://webdecs.wordpress.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@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 / web-app.html
Created November 6, 2012 17:28 — forked from tfausak/ios-8-web-app.html
iOS web app icons & startup images
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<title></title>
<!-- iPhone -->
<link href="http://taylor.fausak.me/static/images/apple-touch-icon-57x57.png"
@dciccale
dciccale / http-ping.sh
Created July 27, 2016 07:22
Print http status every `n` seconds
# Print http status every n seconds
# n defaults to 1s
# usage:
# http-ping google.com .5 (500 milliseconds)
# http-ping google.com 2 (2 seconds)
http-ping() {
n=1 && (($#>1)) && n=$2
while true
do
curl -o /dev/null --silent --head --write-out '%{http_code}\n' $1