Rails flash messages with AJAX requests
# Русский перевод для https://github.com/plataformatec/devise/tree/v1.4.7 | |
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n | |
ru: | |
errors: | |
messages: | |
expired: "устарела. Пожалуйста, запросите новую" | |
not_found: "не найдена" | |
already_confirmed: "уже подтверждена. Пожалуйста, попробуйте войти в систему" | |
not_locked: "не заблокирована" |
I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.
Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.
A traditional approach for this on a Rails project is to use something like the acts_as_list
gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional order by position
SQL query.
This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri
#This is how I set up my Rails 3 User model to have a pretty URL/ID "slug" without adding a slug field to the database |
Create droplet of your liking (ubuntu 12.04 x32) Use an xx.04 LTS version
On Digital Ocean, create a DNS entry for your server (xyz.com)
Make sure it has NS records that use digital oceans nameservers
NOTE: the list has moved to https://github.com/sketchplugins/plugin-directory
A list of Sketch plugins hosted at GitHub, in no particular order.
- brandonbeecroft/Lorem-Ipsum-Plugin-for-Sketch This is a plugin for quickly creating Lorem Ipsum text in Sketch
- sebj/Sketch Templates and Plugins for Sketch by Bohemian Coding
- FredericJacobs/crop_Artboard A script to export the Sketch App artboards to the clipboard
- almonk/SketchGit A simple Git client built right into Sketch.
### Nginx ### | |
check process nginx with pidfile /opt/nginx/logs/nginx.pid | |
start program = "/etc/init.d/nginx start" | |
stop program = "/etc/init.d/nginx stop" | |
if cpu > 60% for 2 cycles then alert | |
if cpu > 80% for 5 cycles then restart | |
if memory usage > 80% for 5 cycles then restart | |
if failed host 127.0.0.1 port 80 protocol http | |
then restart | |
if 3 restarts within 5 cycles then timeout |
# paths | |
app_path = "/home/deployer/qna" | |
working_directory "#{app_path}/current" | |
pid "#{app_path}/current/tmp/pids/unicorn.pid" | |
# listen | |
listen "#{app_path}/shared/tmp/sockets/unicorn.qna.sock", backlog: 64 | |
# logging | |
stderr_path "log/unicorn.stderr.log" |
A. Install Using homebrew | |
brew install phantomjs | |
If you encounter error this error, phantomjs: OS X Mavericks or older is required for stable, | |
you can download phantomjs binary. | |
B. Install using binary | |
1. Download phantomjs binary, http://phantomjs.org/download.html |
module ImagesHelper | |
# Example usage: | |
# | |
# image_set_tag_3x "foo_1x.png", alt: "foo" | |
# | |
# Will assume there is a 2x and 3x version and provide those automagically. | |
# | |
# Based on https://gist.github.com/mrreynolds/4fc71c8d09646567111f | |
def image_set_tag_3x(source, options = {}) | |
srcset = [ 2, 3 ].map { |num| |