Skip to content

Instantly share code, notes, and snippets.

View nathansmith's full-sized avatar
😎
Ask me about free high fives!

Nathan Smith nathansmith

😎
Ask me about free high fives!
View GitHub Profile
@nathansmith
nathansmith / webkit_animation.css
Created April 29, 2011 22:05
Force WebKit to use hardware acceleration.
/*
Force WebKit to use hardware acceleration.
*/
.animate_smoothly {
-webkit-transform: translateZ(0);
}
@nathansmith
nathansmith / last_child.js
Created May 1, 2011 19:26
Force IE7 & IE8 to respect :last-child
// Heavy-handed way to force IE7 & IE8 to respect :last-child.
// Note: Using jQuery. Adjust to suit your library, etc.
//
// Style via...
//
// element:last-child,
// element.last-child {
// /* Style here */
// }
//
@nathansmith
nathansmith / window_location_path.js
Created May 3, 2011 15:25
Fixes IE10's broken path
// After some brainstorming with coworker Ara Pehlivanian,
// we came up with this monkey-patch for IE10, to help it
// normalize pathname to work like all other browsers.
//
// This forces path to be equal to "/foo/bar" regardless
// of what window.location.pathname actually resolves to:
//
// -- "/foo/bar" = Correct in all other browsers.
// -- "foo/bar" = Incorrect in IE10.
@nathansmith
nathansmith / detect_full_screen.html
Created May 18, 2011 15:42
Detect full-screen mode for desktop browsers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Detect Full-Screen</title>
<style>
* {
font-family: sans-serif;
line-height: 1.5;
@nathansmith
nathansmith / lithium_center.html
Created May 18, 2011 17:11
Tame Lithium's Center Tag
<!--
Since Lithium is ghetto and wraps its entire
template in a <center> tag, this is how I am
wrestling back some measure of page control.
-->
</center>
<!-- [Your template code here] -->
@nathansmith
nathansmith / min_max.js
Created May 25, 2011 03:09
Find min/max of array or multiple params.
// Takes either an array or comma separated
// parameters. Both can be called two ways:
//
// min(1, 2, 3, 4, 5);
// max(1, 2, 3, 4, 5);
//
// OR:
//
// min([1, 2, 3, 4, 5]);
// max([1, 2, 3, 4, 5]);
@nathansmith
nathansmith / event_killer.html
Created May 25, 2011 21:47
JS to kill hard-coded inline event listeners.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Kill Inline Events</title>
<style>
* {
font-family: sans-serif;
line-height: 1.5;
@nathansmith
nathansmith / web-design-development-learning-resources.md
Last active December 7, 2025 13:37
Resources for learning web design & front-end development
@nathansmith
nathansmith / parseint.js
Created June 15, 2011 15:52
Makes parseInt default to radix of 10.
// Protect against parseInt being used
// without radix, by defaulting to 10.
// Conditionally check value, in case
// future implementations of parseInt
// provide native base-10 by default.
(function(window) {
var _parseInt = window.parseInt;
.background_clip
// Seriously, why isn't this just the
// freakin' default in all browsers?
+background-clip(padding-box)
// Not sure what this does? Have a looksie...
// http://compass-style.org/examples/compass/css3/background-clip
// Crucial, if you have rounded corners on something with
// both background color and a border. Without, background