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 Change = function (id, doc) { | |
| console.log('new change:', id); | |
| this.id = id; | |
| this.glyph = $('<p title="' + this.url() + '"></p>') | |
| .css({ bottom: this.position() }) | |
| .click($.proxy(this.onGlyphClick, this)); | |
| this.changes_in_current_period += 1; | |
| $('#changes .interval:last') |
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 AnnouncementsController < ApplicationController | |
| def index | |
| pagination_options = { :page => params[:page], :per_page => params[:per_page] } | |
| @announcements = Announcement.by_admins( params[:archived], pagination_options ) | |
| end | |
| 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
| function(doc) { | |
| if (doc.content) { | |
| var html = new XML('<foo>bar</foo>'); | |
| emit('bar', 1); | |
| } | |
| } |
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
| # WebPage uses cache??? What the heck is cache in context of a webpage crawling process? It should only crawl pages. You need to inject some dummy cache to prevent caching. | |
| Yeah, that's the assignment as I see it? The crawler crawls and caches stuff it has found and parsed. Your comments are cryptic .) | |
| # thumnail generation is an expensive job, thus lazy-loading. But you are not saving already generated thumbnails in cache. :( | |
| I guess it's pretty obvious the thumbnail stuff is just for illustration, isn't it? But yeah, definitely it should save the generated thumbnail in the cache! But guess what, probably in some hypothetic Thumbnail class? Not in WebPage class? | |
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 Performer | |
| attr_accessor :object, :method_to_call, :parameters_for_method | |
| def initialize(object, method_to_call, *parameters_for_method) | |
| @object, @method_to_call, @parameters_for_method = object, method_to_call, parameters_for_method | |
| end | |
| def perform | |
| puts parameters_for_method.inspect |
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
| #!/usr/bin/env ruby | |
| # | |
| # Based on drbfs example by Kent Sibilev | |
| require 'lib/fusefs' | |
| # We're basically just passing all requests on to the local filesystem. | |
| class UfsDirectory | |
| def initialize(dir) | |
| @dir = dir |
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 KubicekMiddleware | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| #tohle se vola pred aplikaci | |
| env["REQUEST_URI"]="/welcome" | |
| #zavolame aplikaci | |
| status, headers, response = @app.call(env) |
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
| # Czech version | |
| # NOTE: We actually say "Rock-Scissors-Paper" ("Kámen-Nůžky-Papír"), in this order | |
| Kámen | |
| Papír | |
| Nůžky | |
| Raz...Dva...Tři! | |
| Vy: Kámen |
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
| inside('vendor') do | |
| run "ln -s ~/Playground/Rails/rails rails" | |
| end | |
| run "rm public/index.html" | |
| generate(:scaffold, "item name:string") | |
| route "map.root :controller => 'items'" | |
| rake("db:migrate", "development") |
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
| # A Sinatra App as a Rails Plugin | |
| # | |
| # In your Edge Rails app: | |
| # | |
| # ruby script/plugin install git://gist.github.com/50625.git | |
| require 'sinatra/base' | |
| class SinatraRailsPlugin < Sinatra::Base | |