Very Basic Git Workflow
Very, very basic git workflow
git pull
git branch dev_branch
git checkout dev_branch
#make some changes
git checkout master
git merge dev_branch
git branch -d branch_to_delete
git push
Written by Sean Behan on 06/17/2012
Regex for Extracting URLs in Plain Text
Here is a Regex for extracting URLs from text. However, these links will not already be hyperlinked or source attribtues from images or iframes.
This example is in PHP. I was trying to format a Wordpress page to auto hyperlink but preserve embeded ima...
Written by Sean Behan on 04/14/2017
Email Obfuscation and Extraction from Text with Rails
There is a helper method for handling the obfuscation of email addresses in Rails.
mail_to "me@domain.com", "My email", :encode => "hex"
# => My email
If you want to then extract an email address(or all email addresses) from a block of text here is the...
Written by Sean Behan on 06/17/2012
Destroy Children In Rails 2.3
In the parent class place the following code
has_many :posts, :dependent => :destroy
This used to be accomplished with
has_many :posts, :dependent=>true
Check out the Rails docs for more information http://api.rubyonrails.org/classes/ActiveRecord/As...
Written by Sean Behan on 06/17/2012
Convert Array to Object in PHP
function array2obj($data) {
return is_array($data) ? (object) array_map(__FUNCTION__,$data) : $data;
}
Source: http://www.serversidemagazine.com/php/how-to-convert-array-notation-to-object-notation...
Written by Sean Behan on 06/17/2012