Skip to content

Instantly share code, notes, and snippets.

@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@davidzchen
davidzchen / sample-linux.c
Last active June 16, 2024 09:01
Sample C code using the Linux kernel coding style
/*
* Sample file using the Linux kernel coding convention.
*
* https://www.kernel.org/doc/Documentation/CodingStyle
*
* General rules:
* - Indents are tabs and must be 8 spaces wide.
* - Each line must be at most 80 characters long.
* - Use C-style comments.
* - File names should be lower-case.c
@uhhuhyeah
uhhuhyeah / fancy-javascript.js
Created October 22, 2012 04:49
Fancy JavaScript
if ( foo == "bar" || foo == "foobar" || foo == "foo" ) {
//...
}
// can be written as
if ( foo in { bar:1, foobar:1, foo:1 } ) {
//...
}
@uhhuhyeah
uhhuhyeah / dropbox-and-git.sh
Created November 29, 2010 23:31
Use Dropbox as a remote git repo
# Instructions for setting up a remote repo on Dropbox
# Assuming project/repo called 'myrepo'
cd ~/Dropbox
mkdir -p git/myrepo.git
cd !$
git --bare init
cd ~/development/uhy/myrepo
git remote add dropbox file://$HOME/Dropbox/git/myrepo.git
ps -ef | grep " process or pid " | grep -v grep
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {