Skip to content

Instantly share code, notes, and snippets.

View si's full-sized avatar
🌸
Growing PETALS

Si Jobling si

🌸
Growing PETALS
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<ul>
<li>
<a href="/week-1">Reports - 18 Mar</a>
<ul>
<li>
<a href="/week-1/report-1">Report 1 - 18 Mar</a>
</li>
<li>
<a href="/week-1/parent">Group of reports</a>
<ul>
Verifying that "sijobling.id" is my Blockstack ID. https://explorer.blockstack.org/name/sijobling.id
@si
si / keybase.md
Created September 27, 2016 13:01

Keybase proof

I hereby claim:

  • I am si on github.
  • I am si (https://keybase.io/si) on keybase.
  • I have a public key whose fingerprint is 3DD0 CC9E 9013 B4B9 F3AB EA80 BE1F 8A74 AE1D 4280

To claim this, I am signing this object:

@si
si / SassMeister-input-HTML.html
Created April 23, 2015 10:36
Generated by SassMeister.com.
<h1>I (Heart) Sass!</h1>
<p>
We’re just getting to know Sass - say
<q>“hello”</q>.
</p>
<a href="#" class="primary">HELLO</a>
<a href="#" class="secondary">Goodbye</a>
Verifying myself: My Bitcoin username is +sijobling. https://onename.io/sijobling
@si
si / gist:5388750
Created April 15, 2013 15:02
Find elements in CakePHP form field naming convention
// This is the naming convention for date fields
var field_name = "data[model][0][dob][day]";
// Existing regular expression for finding elements.
var reg_fields = /^data\[([a-zA-Z]+)\]\[(\d+)\]\[([a-zA-Z]+)\]\[([a-zA-Z]+)\]?$/ ;
// Match on date fields works ok (not sure why the first index is the full string).
field_elements = field_name.match(reg_fields);
// returns [ "data[model][0][dob][day]" , "model" ,"0", "dob", "day" ]
@si
si / gist:4555566
Created January 17, 2013 12:17
Return next five birthdays from user's date of birth
SELECT first_name, last_name, dob, DATEDIFF(next_birthday, NOW()) AS distance
FROM (
SELECT *, ADDDATE(birthday, INTERVAL birthday < DATE(NOW()) YEAR) AS next_birthday
FROM (
SELECT *, ADDDATE(dob, INTERVAL YEAR(NOW()) - YEAR(dob) YEAR) AS birthday
FROM users
WHERE active = 1 AND dob IS NOT NULL
) AS T1
) AS T2
ORDER BY distance ASC
@si
si / gist:1868882
Created February 20, 2012 11:40
How to compare integers and dates on current and next records
I have a table of petrol purchases, each recording the current odometer reading:
id | odometer | user_id | created
-------------------------------
2 | 63446 | 1 | 2012-01-15 11:27:57
4 | 63835 | 1 | 2012-01-19 17:09:37
5 | 64145 | 1 | 2012-01-28 13:02:08
I want to return each row along with a distance and days lasted for each record (comparing the current record with the next record).