Skip to content

Instantly share code, notes, and snippets.

Working from home

Tom Brown herestomwiththeweather

Working from home
Block or report user

Report or block herestomwiththeweather

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View post-receive
from, to, branch = " "
if (branch =~ /herestomwiththeweather$/) == nil
puts "Received branch #{branch}, not deploying."
deploy_to_dir = '/home/pants/deploy/herestomwiththeweather-jekyll-indieweb'
`unset GIT_DIR && cd "#{deploy_to_dir}" && git pull`
puts "DEPLOY: herestomwiththeweather(#{to}) copied to '#{deploy_to_dir}'"
`cd /home/pants/repositories/herestomwiththeweather-jekyll-indieweb.git/hooks && ./send_webmentions.rb`
View send_webmentions.rb
#!/usr/bin/env ruby
require 'rss'
require 'webmention'
require 'time'
string ='latest_time.txt', 'r') { |f| }
latest = string.strip # RSS timestamp of most recent blog post for which webmentions have been sent
latest_found = latest # RSS timestamp of most recent blog post including new ones found
last_time = Time.parse(latest)
View onename
Verifying that +herestomwiththeweather is my blockchain ID.
herestomwiththeweather / oauth2_mac_client_example.rb
Created Mar 12, 2012
Example code to make hmac signed oauth2 requests
View oauth2_mac_client_example.rb
require 'uri'
require 'cgi'
require 'net/https'
require 'json'
require 'oauth2_mac_client'
# oauth2_mac_client gem at
# usage using this test class:
# > client =
# > client.get_token('refresh_token') # get a new MAC type access token
View OauthToken.rb
def authorized_for?(requested_amount)
['single_payment','recurring_payment'].include?(action_id) && requested_amount <= amount.to_f && !invalidated?
View ability.rb
unless (access_token.nil? || access_token.authorized_for?(exchange.amount))
herestomwiththeweather / authorize.html.erb
Created May 21, 2011
single payment authorization view
View authorize.html.erb
<%= check_box_tag 'authorize' %> authorize <span id="scope-action"><%= @token.action_name %></span> <img src="<%= @token.action_icon_uri %>"> of <%= @token.amount %> <%= @token.asset %>
View create_request_token
def create_request_token(params={})
if params[:scope]
scope_uri = URI.parse(params[:scope])
# XXX ignoring host:port and assuming it's our host:port
filepath = RAILS_ROOT + '/public' + scope_uri.path
if File.exist?(filepath)
# valid asset is required
asset = CGI::parse(scope_uri.query)['asset'][0]
unless asset.blank?
group = Group.find_by_asset(asset)
herestomwiththeweather / request_token
Created May 21, 2011
Single Payment Scope: Request Token
View request_token
POST /oauth/request_token HTTP/1.1
Accept: */*
Connection: close
User-Agent: OAuth gem v0.4.4
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth oauth_callback="http%3A%2F%2Flocalhost%3A3001%2Foauth_callback", oauth_consumer_key="xBoHeeNNFt3LQ7U1tvAb8BVKr32duE6rdWtpCSFD", oauth_nonce="cde4xVNJBZm6XAy3V6EjMk8gy6uTPf5wEdZgKiMlk", oauth_signature="dyP6m%2FQm%2Bvnes86o6dLvD013Yy4%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1305937625", oauth_version="1.0"
Content-Length: 106
View single_payment.json
"name":"single payment",
You can’t perform that action at this time.