Skip to content

Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<object data="index.svg" type="image/svg+xml"></object>
</body>
</html>
View test.yaml
asdfasdf
asd
f
asdf
as
df
asd
f
asd
f
View iframe.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example iframe</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
View test.js
document.body.style.background = "rgba(127,255,127,0.3";
View iframe.html
<!DOCTYPE html>
<meta charset="utf-8">
<h1>Iframe content</h1>
<p><span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam et enim odio. Cum ea officiis itaque a, ratione, ipsum nobis unde vitae inventore nisi, veniam, iusto quod cupiditate ducimus labore!</span><span>Ipsa eius animi repellat nisi vitae id, dolor amet, obcaecati optio possimus tempore ad. Officia, facere tempore quo aliquam voluptate, est a fuga impedit debitis sed, modi officiis totam recusandae.</span></p>
<p><span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat autem voluptatibus accusantium eaque, cupiditate voluptatem quisquam libero eligendi, blanditiis voluptate illo, at vero officiis odio ullam quo. Esse, praesentium, ipsum.</span><span>Accusamus eos iure, magnam adipisci, saepe, numquam officiis dolores nam sunt praesentium ratione cumque harum ipsum fugiat doloremque eius temporibus facere quis aspernatur animi. Perspiciatis deserunt architecto non autem quibusdam!</span></p>
<p><span>Lorem ipsum do
@vwochnik
vwochnik / index.js
Last active Oct 29, 2016
Randomize ghost post dates for sqlite3 database
View index.js
var sqlite3 = require('sqlite3').verbose();
var file = process.argv.slice(-1).pop();
var db = new sqlite3.Database(file);
var start = new Date("2016-01-01"),
end = new Date("2016-10-20");
db.serialize(function() {
var stmt = db.prepare("UPDATE posts SET created_at = ?, updated_at = ?, published_at = ? WHERE id = ?")
db.each("SELECT id, created_at, updated_at, published_at FROM posts", function(err, row) {
if (err) throw new Error(err);
View iframe.html
<!DOCTYPE html>
<meta charset="utf-8">
<h1>Iframe content</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quod doloribus a
modi ullam officia dolore, ea quisquam est. Asperiores, voluptates similique
impedit aperiam, dignissimos nihil possimus itaque ex tenetur laborum!</p>
<p>Quae ipsa, excepturi temporibus ullam quasi corrupti possimus? Unde
provident, non, nulla molestiae veniam reprehenderit soluta. Consequuntur
inventore repellendus numquam, facere, nostrum et officia suscipit fugiat
aperiam modi harum beatae.</p> <p>Corrupti aut aspernatur ut quaerat maiores
@vwochnik
vwochnik / storage.js
Created Aug 25, 2016
Local Storage getter/setter with expiration
View storage.js
/**
* Retrieves or stores a value inside local storage.
* If only the first parameter is specified, the value is retrieved from local storage.
* If a value to store is specified, maxAge must also be specified after which the value is
* considered invalid and removed during successive retrievals.
* @param name key name to set or retrieve
* @param value value to store
* @param maxAge number of hours until expiration
*/
function storage(name, value, maxAge) {