Skip to content

Instantly share code, notes, and snippets.

@mandybess
mandybess / ItemDecoration.java
Last active April 6, 2024 09:56
RecyclerView extension that "sticks" items in the center on scroll
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class ItemDecoration extends RecyclerView.ItemDecoration {
/**
*
* {@link #startPadding} and {@link #endPadding} are final and required on initialization
* because {@link android.support.v7.widget.RecyclerView.ItemDecoration} are drawn
@RohanM
RohanM / ransack.rb
Last active December 16, 2015 00:49 — forked from nilbus/ransack.rb
# Patch for ransack (https://github.com/ernie/ransack) to use scopes
# Helps migrating from Searchlogic or MetaSearch
# Place this file into config/initializer/ransack.rb of your Rails 3.2 project
#
# Usage:
# class Debt < ActiveRecord::Base
# scope_ransackable :overdue
# scope :overdue, lambda { where(["status = 'open' AND due_date < ?", Date.today]) }
# end
#
@shapeshed
shapeshed / nginx_rails_3_1
Created October 10, 2011 19:13
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@vol4ok
vol4ok / _pay_form.erb.html
Created September 20, 2011 06:56
rails + robokassa example
<form action="<%= @pay_desc['mrh_url'] %>" method="post">
<input type=hidden name=MrchLogin value="<%= @pay_desc['mrh_login'] %>">
<input type=hidden name=OutSum value="<%= @pay_desc['out_summ'] %>">
<input type=hidden name=InvId value="<%= @pay_desc['inv_id'] %>">
<input type=hidden name=Desc value="<%= @pay_desc['inv_desc'] %>">
<input type=hidden name=SignatureValue value="<%= @pay_desc['crc'] %>">
<input type=hidden name=Shp_item value="<%= @pay_desc['shp_item'] %>">
<input type=hidden name=IncCurrLabel value="<%= @pay_desc['in_curr'] %>">
<input type=hidden name=Culture value="<%= @pay_desc['culture'] %>">
<input type=submit value='Оплатить'>