Turn Off SSL Verification In Ruby
The following code will disable SSL verification when using Open SSL.
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
It is probably not a good idea to do this in production. But if you are just testing on your development
machine it might...
Written by Sean Behan on 03/02/2017
How to Resolve ERROR 1396 (HY000): Operation CREATE USER failed for Error in MySQL
If you run into this error when trying to create a user in mysql, chances are you already have this user account created.
create user 'someuser'@'localhost' identified by 'somepassword';
ERROR 1396 (HY000): Operation CREATE USER failed for 'someuser...
Written by Sean Behan on 03/02/2017
link_to_function Rails Ajax Reference
Link_to_function syntax for Haml template. Notice the "|" pipe which will allow for new lines in your code.
= link_to_function( "Add Line Item") |
{|page| page.insert_html :bottom, :invoice_line_items, |
:partial => "line_item", :locals=>{:line_item=...
Written by Sean Behan on 06/17/2012
How To Remove Duplicates From a Table with Postgres
Let's create a table that will hold some dummy data.
> create table fruits (id serial primary key, name varchar, color varchar);
> insert into fruits (name, color) values ('apple', 'red');
> insert into fruits (name, color) values ('ap...
Written by Sean Behan on 10/08/2013
Manual ManyToMany Through with Django's ORM
Here is a code snippet that demonstrates how to set up a __ManyToMany through__ relationship in Django. In Rails, the equivalent would be called a __has_many through__ association.
If you set the __through__ argument on the ManyToManyField, Django wil...
Written by Sean Behan on 07/21/2017