Skip to content

Instantly share code, notes, and snippets.

View MisterPhoton's full-sized avatar

Matt Lindell MisterPhoton

  • Caffelli
  • Portland, OR
View GitHub Profile
@MisterPhoton
MisterPhoton / gist:0abc227e782ef1f4017879cd68065727
Created October 2, 2023 20:25
Portland Trail Blazers Camp Roster 2023
+-----+--------------------+------+----------+--------+-----+-----------------+---------+----------+
| No. | Player | Pos. | Ht. (in) | Ht. | Wt. | Prior | Country | NBA Exp. |
+-----+--------------------+------+----------+--------+-----+-----------------+---------+----------+
| 2 | Deandre Ayton | C | 83 | 6' 11" | 250 | Arizona | USA | 5 |
| 41 | Ibou Badji* | C | 85 | 7' 1" | 240 | Wisconsin Herd | Senegal | 1 |
| 13 | Malcolm Brogdon | G | 77 | 6' 5" | 229 | Virginia | USA | 7 |
| 10 | Moses Brown | C | 86 | 7' 2" | 245 | UCLA | USA | 4 |
| 21 | John Butler Jr.* | F | 84 | 7' 0" | 190 | Florida State | USA | 1 |
| 33 | Toumani Camara | G | 80 | 6' 8" | 220 | Georgia | Belgium | R |
@MisterPhoton
MisterPhoton / random_words.py
Created November 13, 2018 22:31
HERE'S YOUR RANDOM STRING GENERATOR, ALYSA.
import string
import random
def id_generator(size=11, chars=string.ascii_uppercase + ' '):
return ''.join(random.choice(chars) for _ in range(size))
print id_generator()
@MisterPhoton
MisterPhoton / searchQuery.sql
Created February 11, 2011 17:34
SearchQuery
SELECT
a.accountId,
a.name AS accountName,
b.name AS businessName,
b.businessId,
n.employee_id AS teamUserId
FROM
Account AS a
JOIN Business AS b ON a.accountId = b.accountId AND b.deleted = 0
JOIN user_notes AS n ON n.user_id = a.accountId AND n.deleted = 0
@MisterPhoton
MisterPhoton / gist:777239
Created January 13, 2011 01:15
D&D AnyDice Two-Fanged Strike
MISS: 0
HIT: 1
CRITICALHIT: 2
function: attack ROLL:n vs DEFENSE:n {
if ROLL = 1 { result: MISS }
if ROLL = 20 {
if ROLL + ATTACK >= DEFENSE { result: CRITICALHIT }
result: HIT
}
@MisterPhoton
MisterPhoton / gist:777229
Created January 13, 2011 01:08
D&D AnyDice Hunter Calc
MISS: 0
HIT: 1
CRITICALHIT: 2
function: attack ROLL:n vs DEFENSE:n {
if ROLL = 1 { result: MISS }
if ROLL = 20 {
if ROLL + ATTACK >= DEFENSE { result: CRITICALHIT }
result: HIT
}
@MisterPhoton
MisterPhoton / NotifierQuery.sql
Created January 3, 2011 21:22
Notifier Query
SET @cutoff = date_add(now(), interval 421 MINUTE);
EXPLAIN SELECT
wpi.itemId,
wpi.label,
wpi.note,
wpi.dueDate,
wp.timeZone,
su.email,
su.firstName,
"","1234567890","123456789012","default","""Salesperson One"" <1234567890>","SIP/1234-0da1c720","DAHDI/1-1","Dial","DAHDI/g2/1234567890","2010-08-31 21:06:34","2010-08-31 21:07:00","2010-08-31 21:07:00",26,0,"NO ANSWER","DOCUMENTATION"
"","1234567890","123456789012","default","""Salesperson One"" <1234567890>","SIP/1234-0da1c720","DAHDI/1-1","Dial","DAHDI/g2/1234567890","2010-08-31 21:06:34",,"2010-08-31 21:07:00",26,0,"NO ANSWER","DOCUMENTATION"
Modify this regex to be able to parse the second line, above, that is missing one timestamp:
"([^"]*)","([^"]*)","([^"]*)","([^"]*)","""([^"{3}]*)"{2} ([^"]+)","([^"]*)","([^"]*)","([^"]*)","([^"]*)","([^"]*)","([^"]*)","([^"]*)",([^,]*),([^,]*),"([^"]*)","([^"]*)"
/**
* Returns all payments or invoices made within a certain date range.
*
* @param Zend_Date $start
* @param Zend_Date $end
* @return System_Db_DataObject_Collection
*/
public static function getPaymentsByDateRange(Zend_Date $start, Zend_Date $end) {
require_once 'System/Db/DataObject/Collection.php';
$collection = new System_Db_DataObject_Collection(self::getDao(), 'Guide_Invoice_Payment');
<?php
require_once 'Zend/Validate/Abstract.php';
/**
* Mo' money, mo' money, mo' money.
*
* @package System_Form_Validate
*/
class System_Form_Validate_Currency extends Zend_Validate_Abstract {
SELECT
sp.invoiceId as 'InvId',
spMin.`date` as 'minDate',
spMax.`date` as 'maxDate'
FROM Guide_Invoice_ScheduledPayments sp
JOIN (SELECT invoiceId, MIN(`date`) as `date` from Guide_Invoice_ScheduledPayments group by invoiceId) as spMin on sp.invoiceId = spMin.invoiceId
JOIN (SELECT invoiceId, MAX(`date`) as `date` from Guide_Invoice_ScheduledPayments group by invoiceId) as spMax on sp.invoiceId = spMax.invoiceId
group by sp.invoiceId
having maxDate > minDate