Skip to content

Instantly share code, notes, and snippets.

View rthor's full-sized avatar

Ragnar Þór Valgeirsson rthor

View GitHub Profile
@rthor
rthor / gist:2292250
Created April 3, 2012 14:01
HTML: Template
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Site</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://www.modernizr.com/downloads/modernizr-latest.js"></script>
@rthor
rthor / gist:2323146
Created April 6, 2012 21:39
jQuery: Import jQuery
<!-- jQuery 1.7.0 min -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
@rthor
rthor / gist:2323180
Created April 6, 2012 21:41
HTML: Tidy
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>Site</title>
</head>
<body>
</body>
</html>
@rthor
rthor / Rakefile
Created December 6, 2012 21:31 — forked from rubenfonseca/Rakefile
Rakefile + CoffeeScript + Titanium Mobile example
DEV_PROVISIONING_UUID = "3E4D9E49-E44B-4B73-AFAD-248C720ECD53"
DEV_SIGN = "Ruben Fonseca"
DEV_APP_NAME = "My greatest app"
DEV_APP_ID = 'com.0x82.app'
TITANIUM_SDK_VERSION = '1.8.2'
IPHONE_SDK_VERSION = '5.0'
BUILDER_PATH = "/Library/Application Support/Titanium/mobilesdk/osx/#{TITANIUM_SDK_VERSION}/iphone/builder.py"
if File.exists?(BUILDER_PATH)
@include single-text-shadow($blur: 0, $color: #ffffff, $voff: 2px);
@rthor
rthor / JavaScript: isArray()
Created March 19, 2013 18:27
JavaScript: isArray()
// When not using jQuery...
var isArray = Array.isArray || function (obj) {
return obj && typeof obj === 'object' && typeof obj.length === 'number' && !obj.propertyIsEnumerable('length');
};
@rthor
rthor / Chromeframe-is.html
Created March 26, 2013 18:30
Icelandic chrome frame comment and styling...
<!--[if lt IE 7]>
<div class="chromeframe">
<div class="container">
<p>Þú er að nota <strong>úreltann</strong> vafra. Vinsamlegast <a href="http://browsehappy.com/">uppfærið vafrann</a> eða <a href="http://www.google.com/chromeframe/?redirect=true">gerið Google Chrome Frame virkt</a> til að gera þessa síðu nothæfa.</p>
<hr>
<p class="en">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
</div>
</div>
/**
* Returns a random number between min and max
*/
function getRandomArbitary (min, max) {
return Math.random() * (max - min) + min;
}
/**
* Returns a random integer between min and max
* Using Math.round() will give you a non-uniform distribution!
@rthor
rthor / Fixed-Navigation.css
Created July 5, 2013 11:08
Makes the navigation scroll with the page when it hits the navigation.
nav.fixed {
position: fixed;
top: 0;
margin-top: 0;
z-index: 1111;
}
@rthor
rthor / grp.js
Created August 6, 2013 20:18
Use console.group like a boss...
// When not using jQuery...
var isArray = Array.isArray || function (obj) {
return obj && typeof obj === 'object' && typeof obj.length === 'number' && !obj.propertyIsEnumerable('length');
};
// Log grouped statements...
var grp = function ( title, arr ) {
arr = arr.reverse();
var len = arr.length,