Skip to content

Instantly share code, notes, and snippets.

@kevmoo
kevmoo / main.dart
Last active May 22, 2025 09:41
Negative zero and simplifying Dart code
void main() {
// Define different scenarios for t5 using Dart records
// (String name, double t5_value, String expected_behavior)
final List<(String name, double t5Value, String expectedBehavior)> scenarios =
[
('t5 is a regular number', 1.0, 'Simplification is okay'),
(
't5 is positive Infinity',
double.infinity,
'Simplification breaks due to NaN',
@lambiengcode
lambiengcode / pip-webrtc-ios.md
Created March 12, 2024 11:46
How to implement Picture in Picture ‐ iOS

In the context of online conferencing increasingly developing, picture in picture is one of the should-have features of online meetings software.

👉 By end of this tutorial, you can expect the picture in picture feature to look like this:

Update Later

Approach

  • Based on Apple Docs, we will implement AVPictureInPictureController in ViewController. So we must create a new ViewController and replace FlutterViewController
  • Configure parameters for AVPictureInPictureController
@KristofferEriksson
KristofferEriksson / useLocation.ts
Created February 11, 2024 16:44
A React Typescript hook that provides real-time geolocation data, complete with heading and speed metrics
import { useEffect, useState } from "react";
interface LocationOptions {
enableHighAccuracy?: boolean;
timeout?: number;
maximumAge?: number;
}
interface LocationState {
coords: {
@sarices
sarices / ai.list
Last active October 5, 2025 13:15
ai clash rule list
DOMAIN-SUFFIX,openai.com
DOMAIN-SUFFIX,sentry.io
DOMAIN-SUFFIX,pay.openai.com
DOMAIN-SUFFIX,identrust.com
DOMAIN,openaiapi-site.azureedge.net
DOMAIN-SUFFIX,chat.openai.com
DOMAIN-SUFFIX,challenges.cloudflare.com
DOMAIN-SUFFIX,auth0.openai.com
DOMAIN-SUFFIX,platform.openai.com
# Add ai.com
@ninehills
ninehills / chatpdf-zh.ipynb
Last active July 8, 2025 20:09
ChatPDF-zh.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active November 24, 2025 12:45
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@theachoem
theachoem / status_tab_bar.dart
Last active February 11, 2025 08:23
TabBar with badge that update color on swap - Demo included (Flutter)
// Copyright 2021, Thea Choem, All rights reserved.
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
class CustomTabBarItem {
final String label;
final String? value;
CustomTabBarItem({
@steipete
steipete / RandomColor.swift
Created April 6, 2021 17:20
Random Color for SwiftUI
extension Color {
/// Return a random color
static var random: Color {
return Color(
red: .random(in: 0...1),
green: .random(in: 0...1),
blue: .random(in: 0...1)
)
}
}
@JamieCurnow
JamieCurnow / firestore.ts
Last active September 30, 2025 14:14
Using Firestore with Typescript
/**
* This Gist is part of a medium article - read here:
* https://jamiecurnow.medium.com/using-firestore-with-typescript-65bd2a602945
*/
// import firstore (obviously)
import { firestore } from "firebase-admin"
// Import or define your types
// import { YourType } from '~/@types'