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
# new model: | |
# /app/models/letsgo_user.rb | |
belongs_to :user | |
belongs_to :letsgo | |
# changes these models: | |
# /app/models/user.rb | |
has_many :letsgo_users | |
has_many :letsgos, through: :letsgo_users |
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
# start with empty list | |
list = [] | |
# split pdf file into many text files (one for each page) | |
# `docsplit text jaarboek.pdf --no-ocr --pages all` | |
# define pattern for email address | |
regex = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i | |
# loop through all the pages |
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
Schrijfwijze Duitse plaatsnamen - geen umlaut gebruiken! | |
ä = ae | |
ö = oe | |
ü = ue | |
ß = ss | |
Dus | |
bijvoorbeeld: |
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
# models/user.rb | |
class User < ActiveRecord::Base | |
def self.current | |
Thread.current[:user] | |
end | |
def self.current=(user) | |
Thread.current[:user] = user | |
end | |
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
# user.rb | |
after_create :create_money_bird_user | |
def create_money_bird_user | |
contact = MoneyBirdContact.new | |
contact.customer_id = "sjamar_#{self.id}" | |
contact.first_name = self.first_name | |
contact.last_name = self.first_name | |
contact.email = self.email | |
if contact.save |
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
#model (idea 100% stolen from ryanb) | |
def author_tokens=(ids) | |
ids.gsub!(/CREATE_(.+?)_END/) do | |
Author.create!(:name => $1).id | |
end | |
self.author_ids = ids.split(",") | |
end | |
# jquery.tokeninput.js |
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
def get_referal | |
# controleren of er een ref-param is (mijndagjeweg.nl?ref=ze.nl) | |
# wordt gebruikt bij aanmelden nieuwe User | |
if params[:ref] | |
cookies[:ref] = params[:ref] | |
end | |
if request.remote_ip == "66.249.66.148" | |
logger.debug "Google BOt" | |
# redirect_to "http://www.teamtrips.nl/" |