Skip to content

Instantly share code, notes, and snippets.

View iHiD's full-sized avatar
💙

Jeremy Walker iHiD

💙
View GitHub Profile
@iHiD
iHiD / stuff.rb
Created October 23, 2013 15:23
Inquisitio
def self.search(name)
User.where(id: Inquisition.search(name, type: "User").ids)
end
describe "User searching" do
it "should return users" do
user = create(:user)
@iHiD
iHiD / nice_and_simple.rb
Created October 24, 2013 15:36
Rebuilding Inquisitio
class Inquisitio
attr_reader :criteria, :limit, :order
def initialize
@criteria = []
@limit = 10
yield(self) if block_given?
end
# DON'T call this _test.rb as you don't want it to run
module AbstractTest
def test_the_abstract_thing
klass.do_something
assert something, klass.something
end
end
@iHiD
iHiD / prune.rb
Created November 6, 2013 01:10
Remove unused images from a Rails app
class Pruner
def initialize(root)
@skip = [
'.', '..', # System files
'.DS_Store', # Mac files
'determiners' # Directories that are programatic
]
@root = root
end
@iHiD
iHiD / manifest_creator.rb
Last active December 30, 2015 08:49
manifest_creator.rb
cloudfront_url = "https://123123.cloudfront.com"
images_dir = "/users/12321/"
manifest_file_path = "/users/12321/manifest.json"
images = Dir["#{@processing_directory}/html/**/*.jpg"].map do |filename|
"#{cloudfront_url}/#{images_dir}/#{filename}"
end
delivery_data = {images: images}
@iHiD
iHiD / Hello.txt
Last active October 26, 2023 13:06
Basic Bookmarklet Code :)
So prefix this with `javascript:` and compress it to one line and it works a treat. I've been playing with it in the chrome inspetor to get started
@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