Skip to content

Instantly share code, notes, and snippets.

@veasey
veasey / justInteger.php
Last active February 17, 2022 16:01
Without copying array of mixed values, filter out anything other than integers
<?php
function justIntegers($val) {
return is_int($val);
}
$array = ['a', 1, 'b', 2];
print_r(array_filter($array, "justIntegers"));
@veasey
veasey / .emacs
Created December 19, 2017 12:53
Emacs SetUp
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
// attempt to find the user with the given FQML global ID
$user = User::findByIdentifier($employee->FqmlGlobalId);
// ...
// If there is no user found
if (!($user instanceof User)) {
$user = new User();
$user->fqml_global_id = $employee->FqmlGlobalId;