Attention: if you attempt to fork this gist, github will think that you are a spammer and you will have to confirm that you are human with them. Apparantly there are too many links in this list. Also I update it rather frequently (see revisions on the left), so it's probably wise to not fork it anyway.
This file contains 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
source :rubygems | |
gem 'shotgun', :group=>:development | |
gem 'rack-cache' | |
gem 'sinatra', :require => 'sinatra/base' | |
gem 'sinatra-support' | |
gem 'haml' |
This file contains 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
#place this in config/locales/translit.rb | |
# encoding: utf-8 | |
# I18n transliteration delegates to Russian::Transliteration (we're unable | |
# to use common I18n transliteration tables with Russian) | |
# | |
# Правило транслитерации для I18n использует Russian::Transliteration | |
# (использовать обычный механизм и таблицу транслитерации I18n с | |
# русским языком не получится) |
This file contains 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
ru: | |
devise: | |
confirmations: | |
confirmed: "Ваша учётная запись подтверждена. Теперь вы вошли в систему." | |
send_instructions: "В течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи." | |
send_paranoid_instructions: "Если ваш адрес email есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи." | |
failure: | |
already_authenticated: "Вы уже вошли в систему." | |
inactive: "Ваша учётная запись ещё не активирована." | |
invalid: "Неверный адрес email или пароль." |
This file contains 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 ApplicationController < ActionController::Base | |
# ... | |
unless Rails.application.config.consider_all_requests_local | |
rescue_from Exception, with: lambda { |exception| render_error 500, exception } | |
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception } | |
end | |
private | |
def render_error(status, exception) |
This file contains 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 formtastic input which incorporates carrierwave uploader functionality. | |
# | |
# Intelligently adds the cache field, displays and links to the current | |
# value if there is one, adds a class to the wrapper when replacing an | |
# existing value, allows removing an existing value with the checkbox | |
# taking into account validation requirements. | |
# | |
# There are several options: | |
# | |
# * Toggle the replacement field with `replaceable: true/false`. |
- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
- WYSIWYG HTML
- integrates with MoxieManager for file management (PHP only)
This file contains 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 maybe(value) { | |
var obj = null; | |
function isEmpty() { return value === undefined || value === null } | |
function nonEmpty() { return !isEmpty() } | |
obj = { | |
map: function (f) { return isEmpty() ? obj : maybe(f(value)) }, | |
getOrElse: function (n) { return isEmpty() ? n : value }, | |
isEmpty: isEmpty, | |
nonEmpty: nonEmpty | |
} |
This file contains 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
# app/constraints/photo_constraint.rb | |
class PhotoConstraint | |
def initialize | |
@types = Photo::TYPES | |
end | |
def self.matches?(request) | |
@types.include?(request.path_parameters[:type]) | |
end | |
end |
OlderNewer