Skip to content

Instantly share code, notes, and snippets.

@ripter
ripter / code.html
Created September 15, 2017 22:18
HTML Free HTML
<!DOCTYPE html>
<script>
const a = document.createElement('a');
const aText = document.createTextNode('document.compatMode');
a.setAttribute('href', 'https://dom.spec.whatwg.org/#dom-document-compatmode');
a.appendChild(aText);
document.body.appendChild(a);
</script>
@ripter
ripter / scriptBody.html
Created September 15, 2017 21:10
Minimal Standards Mode HTML
<!DOCTYPE html>
<a href="https://dom.spec.whatwg.org/#dom-document-compatmode">document.compatMode</a>
<script>
console.log('in standards mode?', document.compatMode === 'CSS1Compat');
</script>
@ripter
ripter / scriptHead.html
Created September 15, 2017 21:09
Minimal Standards Mode HTML
<!DOCTYPE html>
<script>
console.log('in standards mode?', document.compatMode === 'CSS1Compat');
</script>
<a href="https://dom.spec.whatwg.org/#dom-document-compatmode">document.compatMode</a>
@ripter
ripter / min.html
Created September 15, 2017 21:08
Minimal Standards Mode HTML
<!DOCTYPE html>
<script>
console.log('in standards mode?', document.compatMode === 'CSS1Compat');
</script>
@ripter
ripter / javascript.js
Created September 14, 2017 23:55
Example of Attributes in JavaScript
var o = {}; // Creates a new object
// Example of an object property added
// with defineProperty with a data property descriptor
Object.defineProperty(o, 'a', {
value: 37, // attribute name/key is 'value', it's value is 37
writable: true, // attribute name/key is 'writable', it's value is true
enumerable: true, // attribute name/key is 'enumerable', it's value is true
configurable: true, // attribute name/key is 'configurable', it's value is true
});
@ripter
ripter / dom.js
Last active September 15, 2017 21:27
DOM Attributes Example
const a = document.getElementsByTagName('a')[0]; // get <a> from the example html
const p = document.getElementsByTagName('p')[0]; // get <p> from the example html
// Get/Read Attributes
a.attributes.href; // returns NamedNodeMap href="//github.com"
a.getAttribute('href'); // returns "//github.com"
// Set/Write Attributes.
p.attributes.style.value = 'color: green;'; // set the attribute value.
p.setAttribute('style', 'color: white;'); // set the inline style
@ripter
ripter / attributes.html
Created September 14, 2017 23:48
Example of Attributes in HTML
<a href="//github.com">href is an HTML attribute</a>
<p style="background-color: orange;">style is also an HTML attribute</p>
@ripter
ripter / attrributes.html
Last active September 15, 2017 21:27
Attributes
<a href="//github.com">href is an HTML attribute</a>
<p style="background-color: orange;">style is also an HTML attribute</p>
@ripter
ripter / docker.md
Last active November 18, 2015 19:05
Helpful Scripts

##Copy from host to container docker cp ~/myfile container:/somedir

@ripter
ripter / processTemplate.js
Created April 24, 2015 03:15
Command line tool to process a lodash/underscore template.
#!/usr/bin/env node
/*global require, process */
'use strict';
var fs = require('fs');
var _ = require('lodash');
var Q = require('q');
var program = require('commander');
var readFile = Q.denodeify(fs.readFile);