Skip to content

Instantly share code, notes, and snippets.

View stvedt's full-sized avatar

Sven Tvedt stvedt

View GitHub Profile
<form action="" method="post" name="mobile-usability">
Username: <input name="email" type="text" size="20">
</form>
$(document).ready(function() {
$('input').keyup(function(){
var $this = $(this);
var characters = $this.val().length;
var maxLength = $this.attr('maxLength');
if( characters == maxLength){
$this.next().focus();
}
});
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Page Loading</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
</head>
<body>
<p>This is a paragraph</p>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tab Alerts</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
var baseTitle = document.title;
setInterval(updateTitle, 2000);
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Accurate Viewport with jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
var viewPort = $(window);
$(document).ready(function(){
var pageName = getPage();
$('#nav a').each(function(){
var $this = $(this);
var anchorHref = $this.attr('href');
if( anchorHref == pageName) $this.addClass('current');
});
function getPage(){
@stvedt
stvedt / git-cheat-sheet.md
Created November 29, 2012 15:27 — forked from iansheridan/git-cheat-sheet.md
A cheat sheet for GIT

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

Contract Killer 3

Revised date: 05/11/2013

Between us Stephen Tvedt and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@stvedt
stvedt / about.html
Created April 8, 2013 15:17
Demonstration of a gracefully degrading and search engine optimized AJAX technique.
<!DOCTYPE html>
<html>
<head>
<title>Example by Stephen Tvedt</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<nav>
<a href="index.html">Home</a>
<a href="about.html">About</a>
@stvedt
stvedt / gist:35d3809a87afb337fc84
Created April 25, 2015 18:39
H2A Spawn Times
30 second despawn (walk over resets despawn)
Shrine
Snipe 2:10
Rocks 2:30
Lockdown
Snipe 40s
Sword 40s