Skip to content

Instantly share code, notes, and snippets.

@nashingofteeth
nashingofteeth / index.html
Created July 30, 2012 19:44 — forked from anonymous/index.html
A web page created at CodePen.io.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mechanical Grass &middot; CodePen</title>
<!--
Copyright (c) 2012 Tim Holman, http://codepen.io/tholman
Permission is hereby granted, free of charge, to any person obtaining
<script type="text/javascript">
function setTime() {
var timeOut = false;
var currentDate = new Date();
var seconds = currentDate.getSeconds();
var minutes = currentDate.getMinutes() * 60;
var hours = currentDate.getHours() * 3600;
var myriaseconds = seconds + minutes + hours;
var mt = myriaseconds/10000;
document.body.innerHTML = mt.toPrecision(5);
@nashingofteeth
nashingofteeth / index.html
Last active August 29, 2015 14:14 — forked from anonymous/1.html
url to link conversion with A tag protection
<div contenteditable>http://google.com</div>
<script>
document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 13) { // enter key
var text = document.querySelector('div').innerHTML;
var url = text.match(/(HTTP:\/\/)([a-zA-Z0-9.\/&?_=!*,\(\)+-]+)/i);
var foourl = url[0].replace("http", "foo");
document.foo = "foo";
document.http = "http";