Skip to content

Instantly share code, notes, and snippets.

View linhyo's full-sized avatar

Dieu Linh linhyo

  • HANU
  • Hanoi, Vietnam
View GitHub Profile
@victorb
victorb / app.js
Created September 24, 2013 16:37
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
@rbarazi
rbarazi / user.rb
Created March 9, 2010 05:33
[Beginning Rails 3] Listing 5-37. Current User Model, in app/models/user.rb
require 'digest'
class User < ActiveRecord::Base
attr_accessor :password
validates :email, :uniqueness => true,
:length => { :within => 5..50 },
:format => { :with => /^[^@][\w.-]+@[\w.-]+[.][a-z]{2,4}$/i }
validates :password, :confirmation => true,
:length => { :within => 4..20 },
:presence => true,