Skip to content

Instantly share code, notes, and snippets.

require 'truemail'
require 'minitest/spec'
require 'minitest/autorun'
Truemail.configure do |config|
config.verifier_email = '[email protected]'
config.smtp_safe_check = true # setting to false makes SMTP validation fail
end
def valid?(email)
post '/contact' do
configure_options
Pony.mail(
:from => [params[:name], "<", params[:email], ">"].join,
:to => '[email protected]',
:subject => ["Opt-in via /contact: ", params[:name]].join,
:body => [params[:name], params[:email]].join(": ")
)
redirect '/'
end
@fullstackplus
fullstackplus / stacked-2.html
Created January 8, 2016 11:25
Stacked bar with minimal tooltips
<!--
This is a heavily modified version of Wilson Miner's Timeline Charts example from
A List Apart #256 (http://alistapart.com/article/accessibledatavisualization). Accomodates
a list of stacked subvalues within a single bar segment.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
@fullstackplus
fullstackplus / stacked.html
Created January 6, 2016 14:02
Vertical stacked bar charts (web standards only)
<!--
This is a heavily modified version of Wilson Miner's Timeline Charts example from
A List Apart #256 (http://alistapart.com/article/accessibledatavisualization). Accomodates
a list of stacked subvalues within a single bar segment.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
require 'docverter'
Docverter.base_url = 'http://c.docverter.com'
File.open("out.pdf", "w+") do |f|
f.write(Docverter::Conversion.run do |c|
c.from = "markdown"
c.to = "pdf"
c.add_input_file("input.md")
# c.stylesheet = "stylesheet.css"
Template: template_index
%section
%h1 Recent articles
%ol.recent-articles
- latest_articles(5).each do |article|
%li.group
%div.half
= haml :page_date, :layout => false, :locals => { :page => article }
%h1.article-heading
@fullstackplus
fullstackplus / app.rb
Created June 30, 2014 06:07
App.rb for a new Nesta site
module Nesta
class App
post '/contact' do
configure_options
Pony.mail(
:from => params[:name] + "<" + params[:email] + ">",
:to => '[email protected]',
:subject => params[:name] + " has contacted you",
:body => params[:message]
)
@fullstackplus
fullstackplus / social-sharing-links.rb
Created May 11, 2014 10:12
A set of functions for generating HTML anchors for static pages. Twitter, Google+, and Facebook are supported.
@fullstackplus
fullstackplus / related_articles.haml
Last active December 14, 2015 12:59
Related articles in the view.