Skip to content

Instantly share code, notes, and snippets.

@fullstackplus
fullstackplus / dropcap.js
Created February 6, 2011 16:28
Styled dropcaps with CSS and JavaScript
/*
A function to turn the first letter of the main article of your blog into a styled dropcap.
See example here: http://jamesabbottdd.com/articles
Change the id of the first article to reflect your markup:
var main_entry = document.getElementById("main-entry");
...and you're good to go.
*/
function addDropCap() {
//separate the drop cap
var main_entry = document.getElementById("main-entry");
@fullstackplus
fullstackplus / related_by_category_spec.rb
Created February 18, 2013 14:58
Setting up data for testing with the RelatedByCategory gem (Nesta).
@fullstackplus
fullstackplus / related_articles.haml
Last active December 14, 2015 12:59
Related articles in the view.
@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 / 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 => 'abbottjam@gmail.com',
:subject => params[:name] + " has contacted you",
:body => params[:message]
)
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
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"
@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">
@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">