Skip to content

Instantly share code, notes, and snippets.

View anidotnet's full-sized avatar
🏠
Working from home

Anindya Chatterjee anidotnet

🏠
Working from home
View GitHub Profile
@anidotnet
anidotnet / gist:bec9c144c81e7270fc458e053397419d
Created September 20, 2024 05:48
Flutter Rust Bridge Error Log
RUST_LOG=debug flutter_rust_bridge_codegen generate
[2024-09-20T05:19:53.543Z DEBUG /Users/user1/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.4.0/src/main.rs:24] cli=Cli { verbose: false, command: Generate(GenerateCommandArgs { watch: false, primary: GenerateCommandArgsPrimary { config_file: None, rust_input: None, dart_output: None, c_output: None, duplicated_c_output: None, rust_root: None, rust_output: None, dart_entrypoint_class_name: None, dart_format_line_length: None, dart_preamble: None, rust_preamble: None, no_dart_enums_style: false, no_add_mod_to_lib: false, llvm_path: None, llvm_compiler_opts: None, dart_root: None, no_build_runner: false, extra_headers: None, no_web: false, no_deps_check: false, default_external_library_loader_web_prefix: None, no_dart3: false, full_dep: false, local: false, enable_lifetime: false, type_64bit_int: false, no_default_dart_async: false, stop_on_error: false, dump: None, dump_all: false } }) }
[2024-09-20T05:19:53.545Z DEBUG /Us
Path buildSubmarinePath(Size size) {
return Path()
..moveTo(size.width * 0.1950342, size.height * 7.270667)
..lineTo(size.width * 0.1646269, size.height * 7.270667)
..lineTo(size.width * 0.1646269, size.height * 7.041185)
..lineTo(size.width * 0.1604670, size.height * 7.041185)
..cubicTo(
size.width * 0.1576797,
size.height * 7.152261,
size.width * 0.1548923,
@anidotnet
anidotnet / pom.xml
Created May 11, 2017 03:47
Nitrite Introduction
<dependency>
<groupId>org.dizitart</groupId>
<artifactId>nitrite</artifactId>
<version>1.0</version>
</dependency>
@anidotnet
anidotnet / build.gradle
Created May 11, 2017 03:46
Nitrite Introduction
compile 'org.dizitart:nitrite:1.0'
@anidotnet
anidotnet / InitDatabase.java
Created May 11, 2017 03:44
Nitrite Introduction
Nitrite db = Nitrite.builder()
.compressed()
.filePath("/tmp/test.db")
.openOrCreate("user", "password");
@anidotnet
anidotnet / CreateCollection.java
Created May 11, 2017 03:44
Nitrite Introduction
// Create a Nitrite Collection
NitriteCollection collection = db.getCollection("test");
// Create an Object Repository
ObjectRepository<Employee> repository = db.getRepository(Employee.class);
@anidotnet
anidotnet / CreateDocument.java
Created May 11, 2017 03:43
Nitrite Introduction
// create a document to populate data
Document doc = createDocument("firstName", "John")
.put("lastName", "Doe")
.put("birthDay", new Date())
.put("data", new byte[] {1, 2, 3})
.put("fruits", new ArrayList<String>() {{ add("apple"); add("orange"); add("banana"); }})
.put("note", "a quick brown fox jump over the lazy dog");
@anidotnet
anidotnet / Insert.java
Created May 11, 2017 03:41
Nitrite Introduction
// insert the document
collection.insert(doc);
// update the document
collection.update(eq("firstName", "John"), createDocument("lastName", "Wick"));
// remove the document
collection.remove(doc);
@anidotnet
anidotnet / Query.java
Created May 11, 2017 03:40
Nitrite Introduction
Cursor cursor = collection.find(
// and clause
and(
// firstName == John
eq("firstName", "John"),
// elements of data array is less than 4
elemMatch("data", lt("$", 4)),
// elements of fruits list has one element matching orange
elemMatch("fruits", regex("$", "orange")),
// note field contains string 'quick' using full-text index
@anidotnet
anidotnet / Replication.java
Created May 11, 2017 03:35
Nitrite Introduction
// connect to a DataGate server localhost 9090 port
DataGateClient dataGateClient = new DataGateClient("http://localhost:9090")
.withAuth("userId", "password");
DataGateSyncTemplate syncTemplate
= new DataGateSyncTemplate(dataGateClient, "remote-collection@userId");
// create sync handle
SyncHandle syncHandle = Replicator.of(db)
.forLocal(collection)
// a DataGate sync template implementation
.withSyncTemplate(syncTemplate)