Skip to content

Instantly share code, notes, and snippets.

View RockinPaul's full-sized avatar
🐢

Paul Zarudnev RockinPaul

🐢
  • Amsterdam, Netherlands
View GitHub Profile
@RockinPaul
RockinPaul / json_validator.py
Created November 1, 2024 14:31
json_validator.py - Validate multiple JSON files at once with this Python CLI script
import json
import sys
import os
from pathlib import Path
from typing import Dict, List, Tuple
"""
Validate multiple json files at once.
In Terminal call:
python json_validator.py /path/to/directory/with/jsons
@RockinPaul
RockinPaul / get_current_method_name.dart
Created October 25, 2024 16:59
Dart function to extract the current method name from the stack trace
/// Helper function to extract the current method name from the stack trace
String getCurrentMethodName() {
final frames = StackTrace.current.toString().split('\n');
// The second frame in the stack trace contains the current method
final frame = frames.elementAtOrNull(1);
if (frame != null) {
// Extract the method name from the frame. For example, given this input string:
// #1 LoggerAnalyticsClient.trackAppOpen (package:flutter_ship_app/src/monitoring/logger_analytics_client.dart:28:9)
// The code will return: LoggerAnalyticsClient.trackAppOpen
final tokens = frame
@RockinPaul
RockinPaul / claude_3.5_sonnet_artifacts.xml
Created July 22, 2024 22:40 — forked from SMUsamaShah/claude_3.5_sonnet_artifacts.xml
Claude 3.5 Sonnet, Full Artifacts System Prompt (Updated) + markdown code blocks inside artifact tag (to use in other chat clients)
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
<!-- Add this file to: ~/Library/Developer/Xcode/UserData/FontAndColorThemes -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.901961 0.831373 0.639216 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
@RockinPaul
RockinPaul / extract.dart
Created August 26, 2022 08:12 — forked from magnatronus/extract.dart
Extracting BBC Micro:bit accelerometer data using Flutter Blue
/// This gist assumes that Flutter Blue (https://github.com/pauldemarco/flutter_blue) is used to connect to a BBC Micro:bit
/// and is listening to the [device.onValueChanged] for the correct characteristic ("E95DCA4B-251D-470A-A062FA1922DFA9A8")
///
/// this will be something similar to
///
/// device.onValueChanged( (accChar).listen( (value){ convertRawData(value)}));
///
/// the 'raw' listen value is a List<int> of length 6 this needs to be converted into the X,Y and Z values from the
/// accelerometer and is done with the function below
///
@RockinPaul
RockinPaul / main.dart
Created June 21, 2022 10:45 — forked from ilikerobots/main.dart
Basic examples: Dart call() and Function.apply()
class Adder implements Function {
call(int a, int b) => a + b;
}
class Incrementer implements Function {
int _amt;
Incrementer(this._amt);
call(int a) => a + _amt;
}
@RockinPaul
RockinPaul / custom_tab_bar.dart
Created May 17, 2022 07:30 — forked from theachoem/status_tab_bar.dart
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({
/// Based on the answer of Przemek Broda:
/// https://stackoverflow.com/questions/51825779/blur-background-behind-dialog-flutter/62361699#62361699
import 'dart:ui';
import 'package:flutter/material.dart';
void showProgressView(BuildContext context, {bool dismissible = false}) {
showGeneralDialog(
context: context,
barrierColor: Theme.of(context).colorScheme.surface.withOpacity(0.5),
import 'package:flutter/material.dart';
class Example extends StatelessWidget {
const Example({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;

Working with requirements.txt

pip install -r requirements.txt