Skip to content

Instantly share code, notes, and snippets.

View Godtide's full-sized avatar
🎯
Focusing

Godtide

🎯
Focusing
View GitHub Profile
// contracts/GameItems.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract GameItems is ERC1155, Ownable {
@EcZachly
EcZachly / groups.sql
Created November 6, 2023 21:11
How to write an algorithm to group people in optimized groups based on timezone and track
-- first query all the users
WITH offsets AS (SELECT a.*,
EXTRACT(hour FROM ptn.utc_offset) AS utc_offset
FROM bootcamp.attendees a
JOIN pg_timezone_names ptn ON a.timezone = ptn.name
WHERE a.bootcamp_version = 3
AND a.timezone IS NOT NULL
AND a.content_delivery = 'Live'::text
),
-- then aggregate the users by track and offset, we want matching timezones to fill up first