Skip to content

Instantly share code, notes, and snippets.

View voleoo's full-sized avatar
🏠
Working from home

Viktor Leonets voleoo

🏠
Working from home
View GitHub Profile
mysql -u root -p -e "create database base_name"
mysqldump -h localhost -u root -p base_name > base_name_1378306025.sql
mysql --max-allowed-packet=500M -h localhost -u root -p base_name < base_name_1378306025.sql
-------
cd /Applications/XAMPP/xamppfiles/bin
./mysql

AngularJS best ressources

Following the AngularJS PARIS meetup (25/2 à 19h à Paris with @sampaccoud @dzen @_kemar @tchack13 @vinz et @revolunet)

Here's our best AngularJS ressources : twitter, github, articles & blogs. Please comment and add your good stuff !

validates :email, :password, presence: true
validates :password, length: { in: 6..20 }
validates :email, confirmation: true
validates :email, format: { with: /\A[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})\Z/, :message => "Only emails allowed" }
validates :email, uniqueness: true
validates :credit_card, length: { is: 16 }
validates :price, numericality: true
@voleoo
voleoo / has_one или belongs_to
Created July 9, 2013 18:22
has_one или belongs_to
Все просто, объясню на примере:
Представим следующую ситуацию, у нас есть юзеры, а у каждого юзера есть 1 проект.
В бд это будет так:
таблица users ( id, ... )
таблица projects ( id, user_id, ... )
Нам надо написать такой код:
class Project < ActiveRecord::Base
belongs_to :user
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8