Skip to content

Instantly share code, notes, and snippets.

View ansarizafar's full-sized avatar

Zafar Ansari ansarizafar

View GitHub Profile
@ansarizafar
ansarizafar / readme.md
Created January 12, 2024 13:21 — forked from garth/readme.md
A Yjs provider for socketsupply

You can use it the same as you do with other yjs providers, but you have to pass it a socket which can be created with someting like this:

// set the peer id
const peerId = window.localStorage.getItem('peerId') ?? (await Encryption.createId())
window.localStorage.setItem('peerId', peerId)

// set the signing keys
const keySeed = window.localStorage.getItem('keySeed') ?? createId()
@kamilogorek
kamilogorek / _screenshot.md
Last active May 27, 2024 12:50
Clutter-free VS Code Setup
image
@jiamingkong
jiamingkong / langchain.ipynb
Created May 1, 2023 04:07
Using RWKV in langchain
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@intabulas
intabulas / deploy.md
Last active June 3, 2023 01:10
Deploying SurrealDB to Fly.io

These are the rough steps for getting a surrealdb instance running on fly.io and connecting to it. This is heavily based off of steps posted in the surrealdb discord by rvdende. View Origional Post.

These steps work just fine for the hobby (pay as you go) plan.

HEADS UP By default this will create an instance on a single shared cpu with 256m memory. This is pretty darn small to do anything but experiment, but its free. You can scale your instance to something more useable by visiting the https://fly.io/apps/<appname>/scale. Obviously scaling to larger instances will incur higher costs, please refer to fly.io pricing

Installing fly.io client

source: fly.io docs

@KelsonBall
KelsonBall / ConsoleApp1.csproj
Last active December 20, 2020 20:46
Curly Bracketn't Todos List API in C#
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@rodydavis
rodydavis / flutter_device_utils.dart
Created June 7, 2020 21:20
Flutter Device Utils
import 'package:flutter/foundation.dart';
import 'dart:io';
bool get isWeb => kIsWeb;
bool get isMobile => !isWeb && (Platform.isIOS || Platform.isAndroid);
bool get isDesktop =>
!isWeb && (Platform.isMacOS || Platform.isWindows || Platform.isLinux);
bool get isApple => !isWeb && (Platform.isIOS || Platform.isMacOS);
bool get isGoogle => !isWeb && (Platform.isAndroid || Platform.isFuchsia);
@bjeanes
bjeanes / AAA_uuid_generate_v6mc.sql
Last active July 22, 2022 00:27
Postgres UUIDv6 (non-standard)
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- My port of https://github.com/kurttheviking/uuid-with-v6-js
-- A hacky translation of:
-- - http://gh.peabody.io/uuidv6/
-- - https://tools.ietf.org/html/draft-peabody-dispatch-new-uuid-format
CREATE OR REPLACE FUNCTION uuid_v1_to_v6(v1 uuid)
RETURNS uuid AS $$
DECLARE
v6 text;
@ansarizafar
ansarizafar / icon_gradient.dart
Created December 11, 2019 03:51 — forked from mjohnsullivan/icon_gradient.dart
Apply a color gradient to an icon in Flutter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
void main() {
runApp(_SwitchingThemeApp());
}
/// Properties that help me keep track of the example being run.
bool _useMaterial = false;
class _SwitchingThemeApp extends StatefulWidget {
@override
_SwitchingThemeAppState createState() => _SwitchingThemeAppState();
@mjohnsullivan
mjohnsullivan / curved_appbar.dart
Created November 28, 2019 19:59
A curved Flutter AppBar where widgets scroll nicely beneath the curved portion
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(home: MyHomePage()),
);
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
const curveHeight = 50.0;