Simple SQL for Counting New Signups
Here is a little snippet that will return new signups (or new records) for today
select id, email, created_at::date date from signups
where email not in (select distinct email from signups where created_at < current_date)
Written by Sean Behan on 07/13/2017
How to Parse Query Strings in PHP
Here is a quick snippet for parsing query strings in PHP. You can use the `parse_url` and `parse_str` methods. `parse_str` will create a variable for you populated with results.
$url = "http://www.seanbehan.com/path/?param=key";
parse_str(parse_url...
Written by Sean Behan on 12/04/2017
Using Prototype to Access Form Data
Prototype has a powerful API for accessing and manipulating the Document Object Model, A.K.A the DOM. The following code will let you interact with a simple web form.
Suppose we have a form that contains hidden/or locked inputs and they need to be update...
Written by Sean Behan on 06/17/2012
How to Log and Query SQL Queries Hitting Your Database with MySQL
Here is some code just in case you want to look at and query the queries hitting your MySQL database.
Enter this from the mysql client console.
mysql> SET GLOBAL log_output = 'TABLE'
mysql> SET GLOBAL general_log = 'ON';
mysql> select event_ti...
Written by Sean Behan on 03/17/2018
Nested Attributes in a Form for Has_One Model Association in Rails
Just for reference...
class Member < ActiveRecord::Base
has_one :member_profile
accepts_nested_attributes_for :member_profile
end
...
Written by Sean Behan on 06/17/2012