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
#!/bin/bash | |
# MySQL root password | |
ROOTPASS='password' | |
TIMEZONE='Europe/Moscow' | |
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
############## |
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
/etc/apache2/sites-available | |
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
ServerName site.dev | |
ServerAlias www.site.dev | |
DocumentRoot /var/www/site.dev/public_html/ | |
ErrorLog /var/www/site.dev/logs/error.log | |
CustomLog /var/www/site.dev/logs/access.log combined | |
</VirtualHost> |
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
######Установка Ruby с RVM | |
Перед тем, как что-нибудь сделать мы должны убедиться что все пакеты актуальны: | |
$ sudo apt-get update | |
Далее мы можем приступить к установке RVM (Ruby Version Manager). Это программа позволяющая использовать несколько версий Ruby на одной машине. В данном случае она нам нужна чтобы установить последнюю версию Ruby. | |
Если у вас нет curl — его можно установить командой: | |
$ sudo apt-get install curl | |
Затем ставим RVM: | |
$ curl -L get.rvm.io | bash -s stable |
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
Довольно-таки старое свойство (работает в IE 6!), однако официально было добавлено только к стандарту CSS3. Так как его применение нечасто встречается в сети, можно сделать вывод, что о нем знают не все. | |
.text-overflow { | |
white-space: nowrap; /* Перво-наперво, запретим перенос строк */ | |
overflow: hidden; /* Скрываем текст, который не помещается в блок */ | |
text-overflow: ellipsis; /* Уводим текст в многоточие */ | |
display: block; /* Элемент обязательно должен быть блочным */ | |
} |
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
git config --global user.name "Gorbunov Vadim" | |
git config --global user.email [email protected] | |
[alias] | |
st = status | |
ci = commit | |
br = branch | |
co = checkout | |
df = diff | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit |
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
sum += value | |
count ++ | |
delta = sum / count / count // delta = average/count | |
if value < median { | |
median -= delta | |
} else { | |
median += delta | |
} |
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
<time | |
datetime="<%= @pen.created_at.strftime("%Y-%m-%dT%H:%M") %>" | |
title="<%= @pen.created_at.strftime("%Y-%m-%d at %I:%M %p") %>"> | |
<%= @pen.created_at.strftime("%B %d, %Y") %> | |
</time> |
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 ListingsController < ApplicationController | |
def index | |
movie_listing_service = ServiceLocator.get_service_instance(:MovieListing) | |
@available_movies = movie_listing_service.available_movies | |
render nothing: true #this is just an example don't get hung up on it :) | |
end |
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
<script> | |
(function(){ | |
function addFont() { | |
var style = document.createElement('style'); | |
style.rel = 'stylesheet'; | |
document.head.appendChild(style); | |
style.textContent = localStorage.sourceSansPro; | |
} | |
try { |
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
2.1.2 :026 > Book.where("'history' = ANY (subjects)") | |
Book Load (0.5ms) SELECT "books".* FROM "books" WHERE ('history' = ANY (subjects)) | |
=> #<ActiveRecord::Relation [#<Book id: "39abef75-56af-4ad5-8065-6b4d58729ee0", title: nil, created_at: "2014-10-17 08:21:17", updated_at: "2014-10-17 19:21:25", description: {}, metadata: {}, subjects: ["education", "business", "history", "finances"]>]> | |
2.1.2 :027 > Book.where("subjects @> ?", '{finances}') | |
Book Load (0.5ms) SELECT "books".* FROM "books" WHERE (subjects @> '{finances}') | |
=> #<ActiveRecord::Relation [#<Book id: "39abef75-56af-4ad5-8065-6b4d58729ee0", title: nil, created_at: "2014-10-17 08:21:17", updated_at: "2014-10-17 19:21:25", description: {}, metadata: {}, subjects: ["education", "business", "history", "finances"]>]> |
OlderNewer