Skip to content

Instantly share code, notes, and snippets.

View iHiD's full-sized avatar
💙

Jeremy Walker iHiD

💙
View GitHub Profile
@iHiD
iHiD / rules.md
Created March 25, 2014 12:39
Image Processing

For An Raster Image

  • Large File = Original File
  • Small File = 900x

For a single PPT

  • Large File = We output the first slide at 3000x
  • Small File = We output the first slide at 900x

For a single PPT

  • Large File = We output the first page at 3000x
require 'net/http'
module Indicare
class NewsFeedItemProcessor < Larva::Processor
def news_feed_item_created
publish_to_flumen
end
private
def publish_to_flumen
nfi = MeducationSDK::NewsFeedItem.find(id)
@iHiD
iHiD / article.md
Last active August 29, 2015 14:03
Larva - A wrapper for Propono

Introduction

In my last article I introduced you to Propono - a pub/sub wrapper for Ruby. If you missed it, then I'd recommend going and having a read before you move on to this. To recap, Propono makes it exceptionally easy to publish and subscribe to messages between services using two simple methods:

# Service 1
Propono.listen_to_queue(:user) do |message|
  p "Message Received"
  p message
end
@iHiD
iHiD / instructions
Last active August 29, 2015 14:04 — forked from agraves/instructions
Instructions for clearing expired DigiCert SSL certificate on OSX by [https://gist.github.com/agraves](agraves)
NOTICE: The following instructions "worked for me." Proceed at your own risk.
Symptoms:
* Visiting several sites, such as github, gravatar, twitter's CDN results in "invalid certificate" errors
* For example: http://i.imgur.com/8gPRfI3.png
Instructions
@iHiD
iHiD / application.rb
Created May 26, 2011 13:38
Table Name Bug in Rails 3
# config/application.rb
#...
config.autoload_paths += %W(#{config.root}/app/models/namespaces)
#...
@iHiD
iHiD / product_spec.rb
Created June 26, 2011 18:31
Basic rspec example
#spec/models/product_spec.rb
require 'spec_helper'
describe Product do
before :each do
@valid_attributes = {name: "Test Product",
user: mock_model(User)}
end
@iHiD
iHiD / application.rb
Created May 7, 2012 15:57
How to Build A Secure Website With Ruby On Rails
config.force_ssl = true
@iHiD
iHiD / coffee_script_route_parser.rb
Created June 6, 2012 15:16
Basic CS -> Rails routes converter.
require 'rails/application/route_inspector'
class Journey::Visitors::Formatter
def visit_SYMBOL node
key = node.to_sym
if value = options[key]
consumed[key] = value
value # Overritten this line to avoid escaping of characters
else
@iHiD
iHiD / application.rb
Created June 6, 2012 15:27
How to Build A Secure Website With Ruby On Rails 1
config.force_ssl = true
@iHiD
iHiD / csrf.js
Created June 6, 2012 15:28
How to Build A Secure Website With Ruby On Rails 2
var form_data = //.. Serialise a form
// Get token and param from the meta tags
var token = $('meta[name="csrf-token"]').attr('content');
var param = $('meta[name="csrf-param"]').attr('content');
// Create url of "/settings/profile?name=Jeremy+Walker&authenticity_token=askdsalewg303y09sd00dshb0b00ac0dffbafds"
document.location = "/settings/profile?_method=PUT&" + form_data + "&" + token + "=" + param;