Skip to content

Instantly share code, notes, and snippets.

View ampersanda's full-sized avatar
❤️
.clj

Lucky Pradana ampersanda

❤️
.clj
View GitHub Profile
@ampersanda
ampersanda / playdate-10-print.lua
Last active March 2, 2024 13:20
Playdate 10Print
import "CoreLibs/graphics"
local gfx<const> = playdate.graphics
local dsp<const> = playdate.display
local spacing<const> = 10
local xCount
local yCount
@ampersanda
ampersanda / main.dart
Last active February 6, 2024 16:58
Native drag and drop video splitter
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/scheduler.dart';
import 'package:macos_ui/macos_ui.dart';
import 'package:process_run/process_run.dart';
import 'package:super_clipboard/src/formats_base.dart';
import 'package:super_clipboard/src/reader.dart';
import 'package:super_drag_and_drop/super_drag_and_drop.dart';
@ampersanda
ampersanda / setup_flutter_env.clj
Last active December 5, 2023 14:48
Babashka Script to setup fvm version from pubspec.yaml's environment key
;; environment:
;; sdk: '>=3.1.5 <4.0.0'
;; flutter: '3.16.2' <- from this one
#!/usr/bin/env bb
(require
'[babashka.process :refer [shell process exec]]
'[clojure.java.io :as io])
@ampersanda
ampersanda / graphql.cljd
Last active June 22, 2022 17:57
Initializing GraphQL instance on ClojureDart
(ns project.core.graphql
(:require ["package:graphql/client.dart" :as g]
[project.env :refer [env]]))
(def ^:private http-link (g/HttpLink (:base-url env)))
(def ^:private auth-link
(g/AuthLink :getToken (fn ^:async [])
:headerKey "Authorization"))
@ampersanda
ampersanda / read_password_cli.clj
Created October 28, 2019 23:33
CLI - read password
;; password input is visible when use run
;; but it's invincible if it's executed using java -jar target/your-uberjar-standalone.jar
(defn read-password [prompt]
;; Based on https://groups.google.com/forum/#!topic/clojure/ymDZj7T35x4
(if (= "user" (str (.getName *ns*)))
(do
(print (format "%s [will be echoed to the screen]" prompt))
(flush)
(read-line))
@ampersanda
ampersanda / deps.edn
Last active June 14, 2021 04:31
Switch Flutter SDK project version in IntelliJ IDEA/Android Studio and fvm
{:paths ["."]
:deps {org.clojure/tools.cli {:mvn/version "1.0.194"}}}
@ampersanda
ampersanda / build-ipa.sh
Last active February 1, 2021 13:34
Build IPA from APP in flutter
#!/bin/bash
# Make .app
if ! type "$PWD/.fvm/flutter_sdk/bin/flutter" > /dev/null; then
echo '▵ Using flutter'
flutter build ios
else
echo '▵ Using fvm'
fvm flutter build ios
fi
@ampersanda
ampersanda / single_loading_store_mixin.dart
Created November 13, 2020 05:36
Manage single loading state of Provider's Notifier
mixin SingleLoadingStoreMixin on ChangeNotifier {
/// Loading state
bool _isLoading = false;
/// Loading getter
bool get isLoading => _isLoading;
/// Set loading state to true
void $showLoading() {
if (!_isLoading) {
@ampersanda
ampersanda / field_debounce_mixin.dart
Last active August 14, 2020 10:32
Mixin Collections
import 'dart:async';
import 'package:flutter/widgets.dart';
/// provide single [TextField] debounce timer and handle controller and callback
/// by implementing [SingleFieldDebounceState] in [State] class
///
mixin SingleFieldDebounceProvider<T extends StatefulWidget>
on SingleFieldDebounceState<T> {
Timer _debouncedSearchTimer;