Painting Blue Code
Simple, self-explanatory code snippets.
2020-04-23
MongoDB - Find documents with _ids of the ObjectId type
db.collection_name.find
(
{
"_id"
:
{
$type
:
"objectId"
}}
);
2020-04-20
Python - How to determine the default/active version on your profile
(1) Command-line method:
python
--version
(2) Code method:
import
sys
print(
sys.version
)
2020-04-18
jQuery - How to reset an entire form with a single command
$("
#form_id_here
").
trigger
("
reset
");
2020-04-13
MongoDB - Starts with string search
db.
collection_name
.find({ "
field_name
" :
/^
string_here
/
});
2020-04-06
jQuery - Scroll to first element of a given class or selector
$('html, body').
animate
(
{
scrollTop
: $('
CSS_SELECTOR
').first().offset().top
}
, 750
);
2020-02-23
MySQL - Split a string where substring is found
select
SUBSTRING_INDEX
('part 1, part 2', ',',
1
) as part_1
,
SUBSTRING_INDEX
('part 1, part 2', ',',
-1
) as part_2
;
2020-02-07
MacOS - Folder file count in terminal
find
. -not -type d | wc -l
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)