Skip to content

Instantly share code, notes, and snippets.

View mfo's full-sized avatar
💭
part time available for intersting projects

mfo mfo

💭
part time available for intersting projects
View GitHub Profile
@mfo
mfo / fa-on-diet.sh
Last active April 30, 2016 08:10
wip: extract all uniq font awesome
grep -r "fa-" \
--include=\*.{rb,haml,jst,js} \
--exclude=\*xregexp\* \
--exclude-dir={public,.//app/assets/javascripts/i18n,.//app/assets/javascripts/i18n/web} \
./ \
> icons.txt
ruby -e 'File.read("./icons.txt").scan(/(fa(?:-\w+)+)/).flatten.uniq'
EventMachine::HttpRequest.use EventMachine::Middleware::JSONResponse
# prepare request
con = EventMachine::HttpRequest.new('https://stream.twitter.com/1.1/statuses/filter.json', {
connect_timeout: 0,
inactivity_timeout: 0,
keepalive: true
})
# plug oauth
con.use EventMachine::Middleware::OAuth({...keys..})
# setup tracking
@mfo
mfo / streaming_render_test.rb
Last active August 23, 2017 07:09
StreamingTemplateRenderer maybe cleaner
# frozen_string_literal: true
require "fiber"
module ActionView
# == TODO
#
# * Support streaming from child templates, partials and so on.
# * Rack::Cache needs to support streaming bodies
class StreamingTemplateRenderer < TemplateRenderer #:nodoc:
# Ruby fibers does not support Thread.current[:locals]