Skip to content

Instantly share code, notes, and snippets.

NOTE TO CONTRIBUTORS : Take this wherever you like. If you have articles that really helped you, add them to the list of resources at the end. All content added to this EtherPad is considered public domain. Add your name to the list of contributors at the end of you want attribution.

Suggestions on where to eventually take this content are welcome. I was thinking of making it into a Github pages branch, or maybe on a wiki somewhere?

Testing Chef Cookbooks : A Landscape

There seem to be many approaches to test driving your Chef infrastructure, and the amount of projects to pick from is overwhelming. This document tries to provide some overview.

@plexus
plexus / SPEC.md
Last active December 17, 2015 15:08

HTML Expressions (hexp) Specification

HTML Expressions, hexps for short, are a subset of s-expressions. They provide a convention for working with HTML data in applications in a structured fashion.

Most languages contain a DOM implementation to work with HTML/XML documents, fragments and nodes. However, generating HTML through the DOM API is verbose and tedious. A hexp implementation MUST implement conversions from and to DOM documents. A hexp implementation MAY NOT convert directly from or to HTML.

A hexp implementation MUST implement hexp normalization. Several shorthands are provided for the convenience of the programmer when entering literal hexps. These non-strict hexps must be normalized to strict hexps before further manipulation.

Strict hexps

Web Linguistics : Towards Higher Fluency

About the talk

The idea for this talk came with digging in to web security after last winter's Rails vulnerabilities. Whole categories of vulnerabilities are due to not properly escaping inputs, at least that is the common wisdom : ESCAPE ALL THE THINGS.

Fact is that having to do escaping manually will always be error prone. Using SafeBuffer to automatically escape in views/templates might seem like a good idea, but it's not addressing the structural problem : that we're manipulating structured data (like a DOM) as plain text.

It can be quite an epiphany to look at it from that angle. Plain text representations should be considered a serialization format. It is not sensible to write that by hand. It's more complex than is commonly acknowledged. What if you have a URL inside CSS inside JSON inside HTML?

add this to the Gemfile

gem 'auto_html`

Then create a field in the database to store the media URL

rails generate migration add_media_url_to_profiles media_url:string

add this to the Gemfile

gem 'auto_html`

Then create a field in the database to store the media URL

rails generate migration add_media_url_to_profiles media_url:string
// In code climate, when you mark a security warning as being a false positive,
// You get redirected to the security dashboard. This is extremely annoying when
// there's a whole category of alerts that are false positives. Run this in your
// browser console to add an alternative button that does the POST in the background
// so you stay on the same page.
function adapt_form(idx) {
var button = $('<a>Move to false positives</a>')[0]
var form = this;
$(button).click(
# Summary Ruby introduction
puts "hello there!"
5+5
"this is a string"
'this is also string'
7
puts 'this is also string'
puts 7
puts "bla" + ' hello'
# -*- coding: utf-8 -*-
# Quick rendition of Conway's game of life
class Grid
attr_reader :width, :height
CHARS=[
' ·•◌◉◍◎●',
' ·•◌◔◑◕◍●',
' ⚀⚁⚂⚃⚄⚅',
' ⚋⚊⚏⚍⚎⚌☷☳☵☶☱☲☴☰',
' ✡✢✣✤✥✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋',
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQENBFHIAzIBCACpxtq9t/7RhTtFQdTlwpqFoQUOPERYE92WVf7DMwm3qZAvqIC4
yruqEwEcD9p+PL9Y+DpVjRsZ/qcyOfZiEt0dWSCxmgdBywIq0B3Uojfmkx9IOk9J
MvRd4TJeu88kK0iIXttNlxbd03wSvpyew/G4x5mqDoEs4bVEithX58v7+tSQe7Iv
RWGL2ics8fNXrePWbu1RU4vv4qRxuVvtVbTReoxDmQbgp+yB0Jqb6yw2sQMJgXVm
MTbsc1dQd4bGOPLc2K8P8BqaTvS9IpO72xkFnhv5DahmgYWaX1oKtFcfWZnvPZ8u
tA5hTfiB7+YKYWW/a2W7S3Ua//ZcpGU7xMr7ABEBAAG0L0FybmUgQnJhc3NldXIg
KEBwbGV4dXMpIDxhcm5lQGFybmVicmFzc2V1ci5uZXQ+iQE+BBMBAgAoBQJRyAMy