Skip to content

Instantly share code, notes, and snippets.

View NetLancer's full-sized avatar

Ellie NetLancer

  • Samarkand (Uzbekistan)
View GitHub Profile
@NetLancer
NetLancer / ResponsivePW_flexbox_jsbits.php
Last active December 28, 2023 08:41
Responsive PW page via container width observe
<?php namespace ProcessWire;
/**
* Processwire CMS/CMF template file
* Attempt at responsive design via watching corresponding container element
* instead of relying on the whole document width
* Flexbox styling with some javascript sprinkling
* See coupla constants to modify (if needed): BASE_CARD_WIDTH, MAX_CARD_WIDTH
*/
?>
<!DOCTYPE html>
@NetLancer
NetLancer / trailingDotsAnimate.js
Created October 3, 2023 18:25
Animated trailing dots ..
function trailingDotsAnimate(elementId, interval = 250) {
const el = document.getElementById(elementId);
const elText = el.textContent;
var count = 0, min = 0, max = 4;
var increment = true;
setInterval(function() {
if (count == min) {
increment = true;
} else if (count == max) {
@NetLancer
NetLancer / month_with_year_in_range.js
Created July 20, 2023 05:07
Months & Years sequence within given date range
const months = ['oct', 'nov', 'dec', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'july', 'aug', 'sep', 'oct', 'nov', 'dec', 'jan', 'feb', 'mar'];
let year = 2023;
const months_copy = [];
let startsWithJan = (months[0] === 'jan');
let upTo12Months = months.length < 13;
for (let i = 0; i < months.length; i++) {
const curJan = months[i] === 'jan';
if (startsWithJan) {
export const getCurrentUser = async (session) => {
if (!session || typeof session.id !== 'number') {
throw new Error('Invalid session')
}
const qResult = await db.user.findUnique({
where: { id: session.id },
select: { id: true, email: true, roles: true },
})
@NetLancer
NetLancer / brick_wall.svg
Created September 25, 2016 15:43
Brick-wall background for body
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.