Skip to content

Instantly share code, notes, and snippets.

View Swader's full-sized avatar
🏠
Buidling

Bruno Škvorc Swader

🏠
Buidling
View GitHub Profile
#!/bin/bash
# Prevent .env files
ENV_FILES=$(git diff --cached --name-only | grep -E -- '\.env($|\.local|\.prod|\.dev)')
if [[ -n "$ENV_FILES" ]]; then
echo "❌ Blocked: .env file(s) detected:"
echo "$ENV_FILES" | sed 's/^/ /'
exit 1
fi
function kill() {
emulate -L zsh
setopt extendedglob
if (( $# == 0 )); then
builtin kill
return
fi
local is_signal=0 all_numeric=1 arg
for arg in "$@"; do
[[ "$arg" == -* || "$arg" == SIG* ]] && is_signal=1
import ipfsOnlyHashModule from "ipfs-only-hash";
import { resolve } from "node:path";
type HashOptions = {
cidVersion: 0 | 1;
rawLeaves: boolean;
};
type ParsedArgs = {
targetPath?: string;
https://polygontechnology.notion.site/Vibeforge-LLM-Powered-Coding-Workshop-Flash-Hackathon-21c80500116a80c6832fc941b0a0ef34?pvs=73
You are an expert and modern web application development, with a strong focus on local-first development, and decentralized single-point-of-failure-resistant applications.
Key Principles
- Write concise, clear, and technical responses.
- Prioritize maintainability and readability; adhere to clean coding practices throughout your code.
- Use descriptive attribute names for better understanding and collaboration among developers.
- The fewer dependencies, the better. Avoid front end frameworks at all costs, unless extremely minimal and highly necessary.
- Make heavy use of the browser's local storage to store data, and cache aggressively. Where and when possible, prioritize allowing users to enter their own RPC endpoints, API keys, and more, so that if the defaults are broken, they can still use the app.
- Avoid frameworks and build systems at all costs. Prefer simple, direct, and manual approaches. Think Deno2 over Next.js.
@Swader
Swader / build.dart
Created March 14, 2013 18:25
Recursive folder copy in Dart: An updated Dart web_ui build script which recursively copies a folder and its contents to another location. Useful when building for a defined vhost (e.g. Apache with PHP back end for your Dart app) and don't want the build script to relativize your paths to go "one folder up" back from /out into /web to get CSS an…
import 'dart:io';
import 'package:web_ui/component_build.dart';
// Ref: http://www.dartlang.org/articles/dart-web-components/tools.html
main() {
build(new Options().arguments, ['web/index.html']);
//recursiveFolderCopySync('web/assets', 'web/out/assets');
}
bool isSymlink(String pathString) {
@Swader
Swader / bgjs.js
Created December 7, 2013 01:43
Background final part 3
"use strict";
var Base64 = {_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (r) {
var t, e, a, o, h, n, C, c = "", i = 0;
for (r = Base64._utf8_encode(r); i < r.length;)t = r.charCodeAt(i++), e = r.charCodeAt(i++), a = r.charCodeAt(i++), o = t >> 2, h = (3 & t) << 4 | e >> 4, n = (15 & e) << 2 | a >> 6, C = 63 & a, isNaN(e) ? n = C = 64 : isNaN(a) && (C = 64), c = c + this._keyStr.charAt(o) + this._keyStr.charAt(h) + this._keyStr.charAt(n) + this._keyStr.charAt(C);
return c
}, _utf8_encode: function (r) {
r = r.replace(/\r\n/g, "\n");
for (var t = "", e = 0; e < r.length; e++) {
var a = r.charCodeAt(e);
@Swader
Swader / create_failed_jobs_table.php
Created August 27, 2023 11:05
Laravel Breeze Migrations
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
@Swader
Swader / edition_sections.php
Last active September 2, 2023 04:53
Cursor Migration Output
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEditionSectionsTable extends Migration
{
public function up()
{
@Swader
Swader / editions_and_editionsections.php
Created August 27, 2023 19:42
Code Llama Migration Output
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSectionsAndEditionSectionsTables extends Migration
{
/**
* Run the migrations.