Skip to content

Instantly share code, notes, and snippets.

View adrian-enspired's full-sized avatar

Adrian adrian-enspired

View GitHub Profile

tables foo and bar can be related via x or y.

           foo
          ------
          foo_id

    foox          fooy
   ------        ------
 foo_id foo_id
<?php
/**
* Looks up a value at given path in an array subject
*
* @param array $subject The subject
* @param string $path Delimited path of keys to follow
* @param string $delimiter Path delimiter to use (defaults to .)
* @return mixed The value at the given path if it exists; null otherwise
*/

given

create table foo (a int, b int);
insert into foo values (1,1),(1,2),(2,1),(2,2),(2,3);

I want to order first by a=1 DESC and second by b, ASC if a=1 and DESC if a<>1.

for example,

select a,b from foo order by a=1 DESC, b ASC;
@adrian-enspired
adrian-enspired / password-tips.md
Last active March 7, 2025 02:36
Password Tips

Password Tips

Choose a password that is long enough, and complex enough, to be difficult to guess. Remember, attackers use specialized software to make millions of guesses per second — it's not just one person typing guesses by hand!

USE

  • Long passwords!
  • Long passwords! Passwords should be 16 characters longer.
@adrian-enspired
adrian-enspired / git.config
Created September 30, 2020 13:30
Various useful git aliases
# general shortcuts
###################
# status
s = status
# update working tree
u = add -u
# commit

conditions: assume the item is undamaged, in good condition, unless specified otherwise. we're not testing items for functionality beyond powering on and having no obvious damage. if you buy something and it has problems, we'll work it out.

photos: you can find photos online of most items. if you want photos of a specific item let us know.

shipping: we prefer local pickup. we will ship smaller items for friends & family, for actual cost.

terms

  • NYI - not yet inspected. ask and we'll open it up.
  • anyone - price for anyone off the street
  • family - price for family, friends, coworkers