This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Child</title> | |
| </head> | |
| <body> | |
| <h1>Child Window</h1> | |
This file contains hidden or 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
| -- Пусть имеется таблица positions, содержащая поле category_id, | |
| -- осуществите выборку из таблицы таким образом, чтобы в результирующую | |
| -- таблицу попали по 5 последних записей из каждой категории. | |
| -- +----+-------------------+-------------+---------------------+ | |
| -- | id | name | category_id | updated_at | | |
| -- +----+-------------------+-------------+---------------------+ | |
| -- | 9 | Позиция 9 | 1 | 2012-01-09 00:00:00 | | |
| -- | 8 | Позиция 8 | 1 | 2012-01-08 00:00:00 | | |
| -- | 7 | Позиция 7 | 1 | 2012-01-07 00:00:00 | |
This file contains hidden or 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
| -- Следует удалить из таблицы post устаревшие записи, | |
| -- таким образом, чтобы остались последние 5 записей | |
| -- (по полю updated_at) | |
| -- | |
| -- Хорошо бы задачу решить при помощи одного запроса | |
| -- (многотабличный вариант DELETE с самообъединением). | |
| -- | |
| -- Предполагается, что количество записей в таблице | |
| -- произвольное, поэтому следующий запрос использовать | |
| -- не допускается |
This file contains hidden or 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
| module CarrierWave | |
| module MiniMagick | |
| def toaster_filter | |
| manipulate! do |img| | |
| img.modulate '150,80,100' | |
| img.gamma 1.1 | |
| img.contrast | |
| img.contrast | |
| img.contrast | |
| img.contrast |
This file contains hidden or 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
| upstream backend { | |
| server 127.0.0.1:3000 fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name mydomain.com; | |
| root /path/to/project/public; |
This file contains hidden or 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
| # Guide | |
| # Configure the essential configurations below and do the following: | |
| # | |
| # Repository Creation: | |
| # cap deploy:repository:create | |
| # git add . | |
| # git commit -am "initial commit" | |
| # git push origin master | |
| # | |
| # Initial Deployment: |
This file contains hidden or 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
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
This file contains hidden or 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
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: unicorn | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Manage unicorn server | |
| # Description: Start, stop, restart unicorn server for a specific application. | |
| ### END INIT INFO |
This file contains hidden or 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
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby | |
| # - a browser with WebSocket support | |
| # | |
| # Usage: | |
| # ruby redis_pubsub_demo.rb | |
| # |
This file contains hidden or 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
| # Session controller | |
| def auth | |
| if ["vk","fb","ok"].include?(params[:provider]) | |
| url = client(params[:provider].to_sym)\ | |
| .auth_code\ | |
| .authorize_url({:redirect_uri =>redirect_uri(params[:provider])}) | |
| redirect_to url | |
| else | |
| flash[:error] = t("msg.oauth_error") |
NewerOlder