Forked from David DeSandro's Pen Masonry - columnWidth.
A Pen by Arturo Escartin on CodePen.
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'rubygems' | |
require 'redcarpet' | |
p_replace = '<p style="padding-top:10px;padding-left:30px;padding-right:30px;font-family:\'Helvetica Neue\',Helvetica,arial,sans-serif;font-size:15px;font-weight:normal;color:#000;line-height:20px;">' | |
i_replace = '<p><img class="image_fix"' | |
a_replace = '<a style="color:#ffff00;text-decoration:none;background-color:black" target="_blank" href' |
# Using Sequel with Sinatra (Unicorn) on Heroku and getting this error: | |
# Sequel::DatabaseDisconnectError - PG::ConnectionBad: PQconsumeInput() SSL error: decryption failed or bad record mac. | |
# Need to do some forking. | |
# In unicorn.rb: | |
worker_processes 4 # amount of unicorn workers to spin up | |
timeout 30 # restarts workers that hang for 30 seconds | |
preload_app true # avoid regeneration of jekyll site for each fork | |
before_fork do |server, worker| | |
Signal.trap 'TERM' do |
consumer_key_secret = "#{Settings.twitter_key}:#{Settings.twitter_secret}" | |
encoded_key_secret = Base64.strict_encode64(consumer_key_secret) | |
headers = { | |
'Authorization' => "Basic #{encoded_key_secret}", | |
'Content-Type' => "application/x-www-form-urlencoded;charset=UTF-8" | |
} | |
body = 'grant_type=client_credentials' |
# I don't like using the built in Twitter shares, prefering to use my own posting format: "Title": URL. | |
# It's a little childish and stupid, but then, so is high school. | |
# Create a new Bookmark in Safari and drop in the following script. | |
# It will open Twitter and attempt to scrape the title and URL into the tweet. | |
javascript:location.href='twitter://post?message=\"'+encodeURIComponent(document.title)+'\": '+encodeURIComponent(location.href) |
Forked from David DeSandro's Pen Masonry - columnWidth.
A Pen by Arturo Escartin on CodePen.
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require "httparty" | |
endpoint_URL = "http://www.adweek.com/feed/" | |
response = HTTParty.get(endpoint_URL, follow_redirects: true, headers: {"User-Agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"}) | |
puts response |