Skip to content

Instantly share code, notes, and snippets.

View kripy's full-sized avatar
👀
Watching

Arturo Escartin kripy

👀
Watching
View GitHub Profile
#!/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
@kripy
kripy / Masonry Tweaked.markdown
Created October 23, 2015 08:46
Masonry Tweaked
@kripy
kripy / twitter-ios-bookmarklet.txt
Last active October 15, 2015 22:11
Twitter bookmark for posting to iOS.
# 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)
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'
@kripy
kripy / unicorn.rb
Created January 14, 2015 01:33
Heroku Sequel Fork
# 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
@kripy
kripy / allin.rb
Created November 18, 2014 10:58
All In Markdown
#!/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'