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
# encoding: utf-8 | |
module Iceleres | |
class PhoneNumber | |
include EnumerateIt | |
include ActiveModel::Validations | |
ATTRIBUTES = [:area_code, :number, :type, :validation] | |
PHONE_FORMAT = /^[1-9]\d{3}[-\s]?\d{4}/ | |
attr_accessor *ATTRIBUTES |
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
# encoding: utf-8 | |
module Iceleres | |
module HasPhoneNumber | |
def has_phone_number(name, options={}) | |
options.assert_valid_keys [:validate] | |
define_method "#{name}_phone_number=" do |phone_number| | |
self.send("#{name}_phone=", phone_number.number) | |
self.send("#{name}_phone_areacode=", phone_number.area_code) | |
end |
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
def give_specific_permissions_to_user(user, permission) | |
profile = if user.profiles.empty? | |
user_profile = Iceleres::UserProfile.create :user_id => user.id, :profile => Factory(:profile) | |
user_profile.profile | |
else | |
user.profiles.first | |
end | |
profile.permissions << Factory(permission) | |
end |
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
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
require "rails" | |
# Let's load only action controller. If you want | |
# to use active record, just require it as well. | |
require "action_controller/railtie" | |
class MyApp < Rails::Application |
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/bash | |
current_path=`pwd` | |
projects=(webdesk/webdesk webdesk/webdesk-provisioner webdesk/webdesk-product-api | |
webchat/webchat webchat/webchat-provisioner webchat/webchat-product-api | |
pabx-virtual/pabx-virtual-2011 pabx-virtual/pabx-provisioner | |
pabx-virtual/pabx-product-api pabx-virtual/ruby_pabx_core | |
saas_plan_config/saas_plan_config | |
locaweb-utilities/x9 package_pipeline/package_pipeline | |
product-apify/product-apify feed_consumer/feed_consumer |
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
javascript:( | |
function(){ | |
a=document.createElement('SCRIPT'); | |
a.type='text/javascript'; | |
a.src='http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'; | |
document.getElementsByTagName('head')[0].appendChild(a); | |
} | |
)(); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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/bash | |
git status &>- | |
if [ "$?" -ne 0 ]; then | |
printf "%0s$(echo -en "\033[1;31m")Error :$(echo -en "\033[0m") Run this command in a git repo" | |
exit 1 | |
fi | |
declare -A techs=( ["Ruby"]="rb" ["Javascript"]="js" ["Html"]="html" ["Css"]="css") | |
authors=$(git shortlog -s | awk '{print $2}') |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func main() { |
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
class Sample | |
HOURS = { | |
'mon' => [], | |
'tue' => [ | |
['09:00', '19:00'], | |
], | |
'wed' => [ | |
['09:00', '19:00'], | |
], | |
'thu' => [ |
OlderNewer