@author Cristian Ferrari <cristianferrarig@gmail.com> || @energettico
Licensed under WTFPL.
// Usage
# Put this in your ~/.gitconfig or ~/.config/git/config | |
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName> | |
[user] | |
name = Your Full Name | |
email = your@email.tld | |
[color] | |
# Enable colors in color-supporting terminals | |
ui = auto | |
[alias] | |
# List available aliases |
/*! | |
An experiment in getting accurate visible viewport dimensions across devices | |
(c) 2012 Scott Jehl. | |
MIT/GPLv2 Licence | |
*/ | |
function viewportSize(){ | |
var test = document.createElement( "div" ); | |
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;"; |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} | |
#test2 { background-color: red ;} |
# Quick and dirty script to read unique IDs from NFC tags using the ACR122U USB | |
# reader. | |
# | |
# PC/SC-based API details for the ACR122U available at | |
# http://acs.com.hk/drivers/eng/API_ACR122U_v2.01.pdf | |
# | |
# Assumes ruby >= 1.9.2 | |
# `gem install smartcard` first | |
# |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#!/bin/bash | |
while : | |
do | |
clear | |
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $* | |
sleep 1 | |
done |
#!/bin/bash | |
watch --color "git --no-pager log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all -20" |
@author Cristian Ferrari <cristianferrarig@gmail.com> || @energettico
Licensed under WTFPL.
// Usage
<?php | |
// Social share links | |
$links = array(); | |
$share_url = url('node/'.$node->nid, array('absolute' => TRUE)); | |
$links['facebook'] = array( | |
'href' => 'https://www.facebook.com/sharer/sharer.php?u='.$share_url, | |
'title' => t("Facebook"), | |
'attributes' => array( | |
'data-popup-width' => 700, |