Skip to content

Instantly share code, notes, and snippets.

@tokkonopapa
Created June 4, 2011 11:09
Show Gist options
  • Save tokkonopapa/1007809 to your computer and use it in GitHub Desktop.
Save tokkonopapa/1007809 to your computer and use it in GitHub Desktop.
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}
<div id="demo"><p>このメッセージは、3秒後に変わります。</p></div>
$(function() {
$.ajax({
type: "GET",
url: "/gh/gist/response.html/1007809/",
data: {
"delay": 3
},
dataType: "html"
}).success(function(data, textStatus, jqXHR) {
$("#demo").html(data);
});
});
name: Sample 1
description: Sample 1
authors:
- tokkonopapa
resources:
- https://getfirebug.com/firebug-lite-debug.js
normalize_css: yes
<p>この <span>コンテンツ</span> は Gist 上にあります。</p>
<p><span>JavaScript</span> コードが、幾つかの span の背景色を変えます。</p>
<script type='text/javascript'>
$('#demo span').each(function() {
$(this).css({backgroundColor: '#ffb'});
});
</script>
self.onmessage = function(event) {
// from から to までの素数を見つける
var n = event.data.from;
var to = event.data.to;
for (; n <= to; n++) {
var found = false;
var n2 = Math.sqrt(n);
for (var i = 2; i <= n2; i++) {
if (n % i == 0) {
found = true;
break;
}
}
if (!found) {
postMessage(n);
}
}
}
{ "test": "demo" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment