Skip to content

Instantly share code, notes, and snippets.


Stef Lewandowski stefl

View GitHub Profile
stefl / fix.js
Created May 19, 2018
Fix for Next.js / React SSR meta tags have URL-encoded content
View fix.js
// React SSR renders out <meta tags with URL-encoded values.
// That's bad if you need query parameters in your URLs.
// Before: <meta property="og:image"
// content=";h=630&amp;fit=crop&amp;crop=entropy&amp;auto=format&amp;ixlib=js-1.1.1" class="next-head"/>
// (Notice the &amp;s in the URL)
// After: <meta property="og:image"
// content="" class="next-head"/>
// (Notice &amp; is now correctly &
View Prismic Memcache cache
# encoding: utf-8
module Prismic
class Memcache
def initialize(max_size=100)
def set(key, value, expired_in = nil)
View designer.html
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
stefl / Why
Last active Dec 18, 2015
Why Hack?
View Why

Why Hack?

At Makeshift we’re rapidly hacking on digital products that give a leg up to the little guy. We're a team of hackers, designers and product people who get out of bed each morning excited (okay, most mornings) to make new apps that bring our ideas to life.

We're kicking off our new blog series, "Why Hack?" featuring you. We want to know what gets you out of bed in the morning, or more specifically Why and How You Hack!

Over the next month, we will be posting these interviews on our blog + sending them out to our mailing list.

Thanks in advance for your thoughts!

stefl / avatar-caching
Created May 10, 2013
Use memcache on repetitive avatar requests in Rails
View avatar-caching
def avatar(options = {})
key = "avatar-#{nickname}-#{ {|k,v| "#{k}:#{v}" }.join("-")}"
cached_avatar = Rails.cache.fetch(key)
return cached_avatar if cached_avatar
options.reverse_merge!({size: 48})
unless model.nil?
avatar = h.link_to(h.person_path(model)) do
class: 'avatar__img',
data: { src: avatar_address },
stefl / gist:5322519
Last active Dec 15, 2015
The names of the data sets that #nhtg13 have provided. All 9374 of them
View gist:5322519
stefl / gist:5143269
Created Mar 12, 2013
Weird "localhost" oddness
View gist:5143269
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
## localhost
stefl / foundation_paginate.rb
Last active Dec 13, 2015 — forked from mariszin/foundation_paginate.rb
Zurb Foundation now uses 'current' instead of 'active' for the active page.
View foundation_paginate.rb
# Based on and
# Make the will_paginate generate markup for Zurb Foundation
# Put this in config/initializers/foundation_paginate.rb
module WillPaginate
module ViewHelpers
class LinkRenderer < LinkRendererBase
def html_container(html)
tag(:ul, html, container_attributes)
stefl / gist:4540506
Created Jan 15, 2013
Contenteditable hover and focus states
View gist:4540506
[contenteditable]:hover:after {
content: ' click to edit';
font-style: italic;
font-size: 12px;
color: #ccc;
[contenteditable]:hover, [contenteditable]:focus {
background: #FFFFD3;
stefl / gist:2385517
Created Apr 14, 2012
Rails button_to helper using a button tag rather than an input tag
View gist:2385517
def button_to_with_button_element(name, options = {}, html_options = {})
fragment = ::Nokogiri::HTML.fragment(button_to(name, options, html_options))
fragment.css("input[type=submit]").each do |input|
input.replace ::Nokogiri::HTML.fragment("<button class='#{input.attribute("class")} type='submit'>#{input.attribute("value")}</button>")
raw fragment.to_html