This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Breadcrumb example - webpage_2.html</title> | |
</head> | |
<body> | |
<section itemscope itemtype='http://schema.org/WebPage'> | |
<a href='/books'><span itemprop='breadcrumb'>Books</span></a> > | |
<a href='/books/authors'><span itemprop='breadcrumb'>Authors</span></a> > | |
<a href='/books/authors/stephen-king'><span itemprop='breadcrumb'>Stephen King</span></a> |
This file contains hidden or 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
# config/application.rb | |
def Rails.bg_runner(code) | |
ruby_cmd = code.gsub(/("|\s)/) {|m| "\\#{m}" } | |
cmd = %{cd #{Rails.root} && ./script/background #{Rails.env} "#{ruby_cmd}"} | |
Rails.logger.info "IN BACKGROUND #{cmd}" | |
Rails.logger.info system(cmd) | |
end |
This file contains hidden or 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 Attachment < ActiveRecord::Base | |
belongs_to :post | |
mount_uploader :filename, PostAttachmentUploader | |
VIDEO_FORMATS = %W{ogv mp4 webm} | |
PREVIEW_FORMAT = "jpeg" | |
before_save :set_metas | |
after_create :start_encoding!, :if => :video? | |
This file contains hidden or 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
% bundle exec mida http://lawrencewoodman.github.com/mida/news/ | |
Parsing: http://lawrencewoodman.github.com/mida/news/ | |
--- | |
:type: http://schema.org/Blog | |
% bundle exec mida -v http://lawrencewoodman.github.com/mida/news/ | |
Parsing: http://lawrencewoodman.github.com/mida/news/ |
This file contains hidden or 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 Post < ActiveRecord::Base | |
html_schema_type "http://schema.org/BlogPosting" | |
end | |
%article[post, :blogPosts] | |
= link_to post, :itemprop => "url" do | |
%h3[:name]>= post.title | |
.post_body[:articleBody]= post.body.html_safe |
This file contains hidden or 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
// this stuff breaks vkontakte js api | |
Array.prototype.asdf = function() { | |
return 'array'; | |
}; | |
VK.init(function() { | |
VK.api('video.search', {q: 'dfdfd', count: 20}, function(res) { |
This file contains hidden or 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
module Minion | |
module Daemon | |
extend self | |
attr_accessor :pid, :log | |
def fork_or_skip | |
arg = ARGV.join(" ")[/\-d\s\d+/] || ARGV.join(" ")[/\-d/] | |
return unless arg |
This file contains hidden or 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 Report | |
class << self | |
attr_accessor :current | |
def store(string) | |
@current ||= new | |
@current.store(string) | |
end | |
This file contains hidden or 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
var wiget = new Class({ | |
Includes: [Class.MethodMutators], | |
something: function () { | |
return new Element('div'); | |
}.mutator('setter'), | |
onComplete: function () { | |
this.hide(); | |
}.mutator('bind'), |
This file contains hidden or 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
$('some-link').clk(function(el, event) { | |
Footer.render('my-friends', Profile.id); | |
}); | |
var Present = { | |
id: function(present_id, callback){ | |
if (var present = this.getCached(present_id)) { | |
callback(present); | |
} else { | |
this.fetch(present_id, callback); |