Skip to content

Instantly share code, notes, and snippets.

@nashingofteeth
nashingofteeth / index.html
Created February 11, 2011 00:04
css triangle
<style>
#tri {
border-color: black black transparent transparent;
border-style:solid;
border-width: 50px;
width:0;
height:0;
}
</style>
<div id="tri"></div>
@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
@nashingofteeth
nashingofteeth / gist:3213261
Created July 31, 2012 03:29
Go back in history
history.go(-1)
@nashingofteeth
nashingofteeth / notepad.html
Last active October 13, 2015 16:07
simple html notepad
<body contenteditable="true"
onload="document.querySelector('body').innerHTML = window.localStorage.getItem('save');"
onkeyup="window.localStorage.setItem('save', document.querySelector('body').innerHTML);"
style="font-size: 21px; width: 400px; margin: 70px auto auto auto;">
@nashingofteeth
nashingofteeth / linkify.html
Created December 6, 2012 08:48
change plain txt url into html link
<div id="test">
http://google.com
</div>
<script>
var txt = document.querySelector('body').innerHTML;
var pattern = /(HTTP:\/\/|HTTPS:\/\/)([a-zA-Z0-9.\/&?_=!*,\(\)+-]+)/i;
var replace = "<a href=\"$1$2\">$1$2</a>";
var result = txt.replace(pattern , replace);
document.querySelector('body').innerHTML = result;
</script>
@nashingofteeth
nashingofteeth / keycode.html
Last active December 20, 2020 09:17
Javascript keycode finder
<input onkeypress="javascript:return false;" id="txtChar" onkeydown="javascript:return displayKeyCode(event)" type="text" name="txtChar">
<span id="spnCode" name="spnCode"></span>
<script>
<!--
function displayKeyCode(evt)
{
@nashingofteeth
nashingofteeth / color.html
Last active December 16, 2015 03:19
random hexadecimal color generator
<style>
body {
color: white;
font-size: 15vmin;
font-family: helvetica;
text-align: center;
margin-top: 40vh;
text-shadow: .1vw .1vh 5px black;
}
</style>
@nashingofteeth
nashingofteeth / outliner.html
Last active December 16, 2015 16:39
simple outliner
<script>
document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.ctrlKey && evt.keyCode == 13) {
evt.preventDefault();
pasteHtmlAtCaret('<li style="margin-left: 15px;"> </li>');
}
if (evt.altKey && evt.keyCode == 13) {
evt.preventDefault();
pasteHtmlAtCaret('<li style="margin-left: -15px;"> </li>');
@nashingofteeth
nashingofteeth / sand.html
Last active December 16, 2015 20:19
simple html editor
<html>
<head>
<link href="https://dl.dropboxusercontent.com/u/7984474/GitHub/sand/favicon.ico" rel="Shortcut Icon" />
<meta charset="UTF-8">
<title>sand v5 (ace)</title>
<script>
var editboxHTML =
'<script src="https://dl.dropboxusercontent.com/u/7984474/GitHub/sand/hotkeys.js"><\/script>' +
'<script>' +
' shortcut.add("Ctrl+Shift+X",function() { window.setCookie(); });' +
@nashingofteeth
nashingofteeth / gist:8e1049e844eecf93541c
Last active August 29, 2015 14:12
simple hotkey script
document.onkeydown = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 13 && evt.ctrlKey) {
evt.preventDefault();
alert('it works!');
}
};