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
class JsonProtect
def initialize(app)
@app = app
end
def call(env)
dup._call(env)
end
def _call(env)
branches = `git branch`.chomp.split("\n")
branches.map!(&:strip)
branches.each do |branch|
puts "================================"
puts "Considering: #{branch}"
puts
system "git log --color --stat -n 1 #{branch}"
# config/routes.rb
namespace :foo do
match '/' => 'main#index'
resources :bar
resources :baz
end
config.middleware.use Rack::Bug,
:secret_key => "moje_tajne_haslo",
:panel_classes => [
Rack::Bug::TimerPanel,
Rack::Bug::ActiveRecordPanel,
Rack::Bug::CachePanel,
Rack::Bug::SQLPanel,
Rack::Bug::TemplatesPanel,
Rack::Bug::LogPanel,
Rack::Bug::MemoryPanel
<%= cache('your_cache_key', :expires_in => 3.hours) do %>
<!-- computation heavy stuff goes here %>
<% end %>
module ActionController
class AbstractRequest
class << self
def parse_query_parameters(query_string)
return {} if query_string.blank?
query_string = query_string.gsub("amp;", "")
pairs = query_string.split('&').collect do |chunk|
next if chunk.empty?
key, value = chunk.split('=', 2)
{"email" => "moj@mejl.pl", "amp;name" => "Stefan"}
will_paginate @comments,
:prev_label => '&laquo; poprzedni',
:next_label => 'następny &raquo;'
<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>