Skip to content

Instantly share code, notes, and snippets.

View paulingham's full-sized avatar

Paul Ingham paulingham

  • cinch
  • Scotland
View GitHub Profile
@paulingham
paulingham / engine.rb
Created June 24, 2009 20:30 — forked from augustl/engine.rb
Fixed the typos - ie.. divition to division
module Less
class Engine
attr_reader :css
attr_reader :parser, :build_handler, :root_node
def initialize(less)
@less = less.dup
@parser = LessGrammarParser.new
@build_handler = BuildHandler.new
parse
def youtube_video(url, text, height, width)
altered_text = text.gsub(url,"<iframe title='YouTube video player' class='youtube-player' type='text/html' width='#{width}' height='#{height}' src='#{url}' frameborder='0'></iframe>")
end
def vimeo_video(url, text, height, width)
ident_regexp = /\/[0-9]{3,}/
url_ident = url.scan(ident_regexp).to_s
altered_text = text.gsub(url,"<p><iframe title='Vimeo Video Player' src='http://player.vimeo.com/video#{url_ident}' width='#{width}' height='#{height}' frameborder='0'></iframe></p>")
end
module GoggleBox
require 'httparty'
class << self
attr_accessor :adapter
def adapter
@adapter ||= GoggleBox::TVRage
end
end
end
module GoggleBox
require 'httparty'
autoload :TVRage, 'goggle-box/tvrage.rb'
autoload :TheTVDB, 'goggle-box/thetvdb.rb'
class << self
attr_accessor :adapter
def adapter
@adapter ||= GoggleBox::TVRage
module GoggleBox
# require 'httparty'
module TVRage
class Show
def self.search opts={}
"searching TVRage for shows with options #{opts.inspect}"
end
end
end
@paulingham
paulingham / gist:2499767
Created April 26, 2012 13:52
Recruiters.. cold approaches suck!
Seems he didn't understand - read from the bottom up.
Hi Paul,
I did apologize for the nature of the cold approach. No one fully appreciates it. Not even me. But sometimes it simply has to be done.
Again, it was the only form of contact I had for you. If you are not interested then that’s ok. Not everyone will be.
Have you any ROR friends outside of your company that are looking for new roles?
visa: /^4\d{15}(\d{0,3})?$/
mastercard: /^(5[1-5]\d{4}|677189)\d{10}$/
american express: /^3[47]\d{13}$/
maestro: /^6759\d{12}(\d{2,3})?$/
solo: /^6767\d{12}(\d{2,3})?$/
@paulingham
paulingham / gist:6224821
Created August 13, 2013 19:34
Simple cleaner view for the announcement gem.
#### Your view (blah.html.erb) ####
<%= render partial: 'announcement', collection: Article.newest %>
#### _announcement.html.erb ####
<%= announce announcement, { format: 'bootstrap' } %>
#### Explanation ####
## config/initializers/viddler.rb
Viddler.configure do |c|
c.api_key = '',
c.username = '',
c.password = ''
end
## None rails