Skip to content

Instantly share code, notes, and snippets.

@johnmichel
Forked from fgnass/LICENSE.txt
Created June 6, 2011 14:07
Show Gist options
  • Select an option

  • Save johnmichel/1010331 to your computer and use it in GitHub Desktop.

Select an option

Save johnmichel/1010331 to your computer and use it in GitHub Desktop.
display a loading spinner

140byt.es

A tweet-sized, fork-to-play, community-curated collection of JavaScript.

How to play

  1. Click the Fork button above to fork this gist.
  2. Modify all the files to according to the rules below.
  3. Save your entry and tweet it up!

Keep in mind that thanks to the awesome sensibilities of the GitHub team, gists are just repos. So feel free to clone yours and work locally for a more comfortable environment, and to allow commit messages.

Rules

All entries must exist in an index.js file, whose contents are

  1. an assignable, valid Javascript expression that
  2. contains no more than 140 bytes, and
  3. does not leak to the global scope.

All entries must also be licensed under the WTFPL or equally permissive license.

For more information

The 140byt.es site hasn't launched yet, but for now follow @140bytes on Twitter.

To learn about byte-saving hacks for your own code, or to contribute what you've learned, head to the wiki.

140byt.es is brought to you by Jed Schmidt. It was inspired by work from Thomas Fuchs and Dustin Diaz.

function(a,b,c) {
setInterval(function() {
c=-~c; // incremented on each invocation
for(
b=0; // the segment index
b<8; // 8 segments (dots)
c-1||(a.innerHTML+='<b>•'), // create markup upon the first call
a.childNodes[b].className='b'+b+' o'+(c+b++)%8 // assign two classes: b<#> and o<#>
);
},100) // invoke every 100ms
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
#spinner { position: relative; font-size: 22px; }
#spinner b { position:absolute; }
#spinner b.b0 { top:0px; left:20px; }
#spinner b.b1 { top:3px; left:27px; }
#spinner b.b2 { top:10px; left:30px; }
#spinner b.b3 { top:17px; left:27px; }
#spinner b.b4 { top:20px; left:20px; }
#spinner b.b5 { top:17px; left:13px; }
#spinner b.b6 { top:10px; left:09px; }
#spinner b.b7 { top:3px; left:13px; }
#spinner b.o0 { opacity: 0.8; _color: #666; }
#spinner b.o1 { opacity: 0.7; _color: #777; }
#spinner b.o2 { opacity: 0.6; _color: #888; }
#spinner b.o3 { opacity: 0.5; _color: #999; }
#spinner b.o4 { opacity: 0.4; _color: #aaa; }
#spinner b.o5 { opacity: 0.3; _color: #ccc; }
#spinner b.o6 { opacity: 0.2; _color: #ddd; }
#spinner b.o7 { opacity: 0.1; _color: #eee; }
</style>
</head>
<body>
<div id="spinner"></div>
<script>
function spinner(a,b,c){setInterval(function(){c=-~c;for(b=0;b<8;c-1||(a.innerHTML+='<b>•'),a.childNodes[b].className='b'+b+' o'+(c+b++)%8);},100)}
spinner(document.getElementById('spinner'));
</script>
</body>
function(a,b,c){setInterval(function(){c=-~c;for(b=0;b<8;c-1||(a.innerHTML+='<b>•'),a.childNodes[b].className='b'+b+' o'+(c+b++)%8);},100)}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Felix Gnass <https://github.com/fgnass>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "spinner",
"description": "Display a loading spinner.",
"keywords": [
"spinner",
"animation"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment