Skip to content

Instantly share code, notes, and snippets.

View sharnik's full-sized avatar
📱
Developing mobile apps

Wojciech Ogrodowczyk sharnik

📱
Developing mobile apps
View GitHub Profile
site :opscode
cookbook 'apt'
cookbook 'chruby'
@sharnik
sharnik / fancy_sinatra_api.rb
Created March 28, 2014 15:16
rspec_api_documentation usage example
class FancyAPI < API
patch '/:id' do
object = FancyObject.find(params[:id])
object.update(params[:fancy_object]
object.to_json
end
end

Keybase proof

I hereby claim:

  • I am sharnik on github.
  • I am sharnik (https://keybase.io/sharnik) on keybase.
  • I have a public key whose fingerprint is 3784 19EB 4928 F052 EBBF B12D AC2E 2F76 6EE0 8CC3

To claim this, I am signing this object:

$ RUST_BACKTRACE=1 rustc set_1.rs
set_1.rs:7:33: 7:36 error: mismatched types:
expected `u16`,
found `_`
(expected u16,
found floating-point variable) [E0308]
set_1.rs:7 let mut final_score : u16 = 0.0;
^~~
error: internal compiler error: Impl DefId { krate: 2, node: 36957 } was matchable against Obligation(predicate=Binder(TraitPredicate(core::ops::Add<_>)),depth=1) but now is not
note: the compiler unexpectedly panicked. this is a bug.
class PaginationListLinkRenderer < WillPaginate::LinkRenderer
def to_html
links = @options[:page_links] ? windowed_links : []
html = links.join(@options[:separator])
@options[:container] ? @template.content_tag(:ul, html, html_attributes) : html
end
protected
def windowed_links
class PaginationListLinkRenderer < WillPaginate::LinkRenderer
def to_html
links = @options[:page_links] ? windowed_links : []
html = links.join(@options[:separator])
@options[:container] ? @template.content_tag(:ul, html, html_attributes) : html
end
protected
def windowed_links
<div class="pagination">
<span class="disabled prev_page">&laquo; Previous</span>
<span class="current">1</span>
<a href="/users/john/komentarze?page=2" rel="next">2</a>
<a href="/users/john/komentarze?page=3">3</a>
<a href="/users/john/komentarze?page=4">4</a>
<a href="/users/john/komentarze?page=2" class="next_page" rel="next">Next &raquo;</a>
</div>
<ul class="pagination">
<li class="select">1</li>
<li><a href="/users/john/komentarze?page=2">2</a></li>
<li><a href="/users/john/komentarze?page=3">3</a></li>
<li><a href="/users/john/komentarze?page=4">4</a></li>
</ul>
<ul class="pagination">
<li class="select">1</li>
<li><a href="/users/john/komentarze?page=2">2</a></li>
<li><a href="/users/john/komentarze?page=3">3</a></li>
<li><a href="/users/john/komentarze?page=4">4</a></li>
</ul>
will_paginate @comments,
:prev_label => '&laquo; poprzedni',
:next_label => 'następny &raquo;'