This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bar_event_severity | |
data = [] | |
data_labels = [] | |
%w(High Medium Low).each do |x| | |
sym = x.downcase.to_sym | |
unless params[sym].blank? | |
data << params[sym].to_i | |
data_labels << "#{x} Severity" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestItReceiver | |
# show text takes a string, but may have some other params for us to look through | |
def show_text(string, *params) | |
puts string | |
end | |
def show_text_with_positioning(array, *params) | |
# make use of the show text method we already have | |
# assuming we don't care about positioning right now and just want the text | |
show_text(array.select{|i| i.is_a?(String)}.join(""), params) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
receiver = TestItReceiver.new | |
pdf = PDF::Reader.file("sample.pdf", receiver) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tumblr_user = Tumblr::User.new('[email protected]', 'ourtumblrpassword') | |
Tumblr.blog = 'ourtumblrcmsblog' | |
def tumblr_cms(tag) | |
post = Tumblr::Post.first(:tagged => tag) | |
return nil if post.nil? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= tumblr_cms("home_page_top") %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> VinApi.find("1HGCM82633A004352").year | |
=> "2003" | |
>> VinApi.find("1HGCM82633A004352").model | |
=> "ACCORD EX" | |
>> puts VinApi.find("1HGCM82633A004352").attributes.to_yaml | |
--- | |
model: ACCORD EX | |
body_style: COUPE | |
country: UNITED STATES | |
vin: 1HGCM82633A004352 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VinApi < ActiveResource::Base | |
headers["X-VinApiKey"] = "YOUR_API_KEY_GOES_HERE" | |
self.site = "http://vinapi.skizmo.com" | |
self.element_name = "vin" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Testing home top for speedeals.com</h2> | |
<b>Really?</b> | |
<ul> | |
<li>Hello THere...</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function decodeVIN($vin){ | |
$curl = curl_init(); | |
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt ($curl, CURLOPT_URL, 'http://vinapi.skizmo.com/vins/'.$vin.'.xml'); | |
curl_setopt ($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'X-VinApiKey: YOUR_API_KEY_GOES_HERE')); | |
$result = curl_exec ($curl); | |
curl_close ($curl); | |
return $result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'cairo' | |
class Box | |
# height and width for the rectangle, angle for the rotation | |
attr_accessor :height, :width, :angle | |
def initialize(height=200, width=200, angle=45) | |
@height, @width, @angle = [height, width, degrees_to_radians(angle)] | |
# The first argument for a surface is the filename, the next two are our canvas/surface size. |
OlderNewer