Skip to content

Instantly share code, notes, and snippets.

/*
Used like this:
var regex = regex_escape([
'foo',
'bar',
'http://example.com/page'
]);
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods
var m = [
"log", "info", "warn", "error", "debug", "trace", "dir", "group",
"groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd",
"dirxml", "assert", "count", "markTimeline", "timeStamp", "clear"
];
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Drive Google's Streetview Car</title>
<style>
html, body {
height: 100%;
margin: 0;
// Escape regular expression
function regex_escape(thing) {
// Escape the string
function esc(str) {
return str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
}
// Used in loop
var arr, i;
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/solarized_light");e.getSession().setMode("ace/mode/javascript");</script>
/**
* Clip image to hexagon
*/
img {
max-width: 200px;
max-height: 200px;
}
@Neofyt
Neofyt / morse.js
Created December 20, 2012 13:33 — forked from rauschma/morse.js
// Question: which combinations with a maximum length of 4 are unused in international Morse code?
// http://en.wikipedia.org/wiki/Morse_code
var morseCodes = {
'.-': 'A',
'-...': 'B',
'-.-.': 'C',
'-..': 'D',
'.': 'E',
'..-.': 'F',
@Neofyt
Neofyt / dabblet.css
Created April 17, 2012 19:24 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@Neofyt
Neofyt / dabblet.css
Created March 20, 2012 00:50 — forked from JoelBesada/dabblet.css
CSS States
/* CSS States */
body {
background: url(http://dabblet.com/img/noise.png);
background-color: #F5F2F0;
font-family: Georgia, serif;
font-size: 18px;
line-height: 1.6em;
text-shadow: 0 2px 0 white;
color: #222;
}
@Neofyt
Neofyt / dabblet.css
Created January 21, 2012 14:04
Hide the Sidebar!
/*
Hide the Sidebar!
*/
* {
margin: 0;
padding: 0;
border: 0;