Skip to content

Instantly share code, notes, and snippets.

@opsb
opsb / docker-compose.yml
Last active March 20, 2024 17:54
Docker compose for electric
```
version: "3"
services:
db:
image: postgres:16.2
restart: always
ports:
- "15432:5432"
environment:
@opsb
opsb / app_spector_widget.dart
Last active January 27, 2021 10:41
AppSpector flutter widget that supports hot restart
import 'package:appspector/appspector.dart';
import 'package:flutter/material.dart';
class AppSpectorWidget extends StatefulWidget {
final String iosApiKey;
final String androidApiKey;
final Widget child;
AppSpectorWidget(
{@required this.iosApiKey,
{
"Cluster": "arn:aws:ecs:us-west-2:&ExampleAWSAccountNo1;:cluster/default",
"TaskARN": "arn:aws:ecs:us-west-2:&ExampleAWSAccountNo1;:task/default/febee046097849aba589d4435207c04a",
"Family": "query-metadata",
"Revision": "7",
"DesiredStatus": "RUNNING",
"KnownStatus": "RUNNING",
"Limits": {
"CPU": 0.25,
"Memory": 512
{
"DockerId": "c7a6b9b237934e9999f319ea3ccc9da4query-metadata",
"Name": "query-metadata",
"DockerName": "query-metadata",
"Image": "mreferre/eksutils",
"ImageID": "sha256:1b146e73f801617610dcb00441c6423e7c85a7583dd4a65ed1be03cb0e123311",
"Labels": {
"com.amazonaws.ecs.cluster": "arn:aws:ecs:us-west-2:&ExampleAWSAccountNo1;:cluster/default",
"com.amazonaws.ecs.container-name": "query-metadata",
"com.amazonaws.ecs.task-arn": "arn:aws:ecs:us-west-2:&ExampleAWSAccountNo1;:task/default/c7a6b9b237934e9999f319ea3ccc9da4",
@opsb
opsb / NonMutatingArray.swift
Last active February 17, 2022 15:34
Swift extension to add non mutating methods to Array
extension Array {
func inserted(_ element: Element, at index: Int) -> Array<Element> {
return updated({$0.insert(element, at: index)})
}
func appended(_ element: Element) -> Array<Element> {
return updated({$0.append(element)})
}
func appended(contentsOf elements: Array<Element>) -> Array<Element> {
@opsb
opsb / gist:0081ce0a211b3f88e6510eafa4ba2198
Created May 25, 2020 18:39
Map operation on a protocol in swift
public protocol Notifier {
associatedtype Event
init()
func send(_ : Event) -> Void
func map<ChildNotifier, ChildEvent>(_ : (Event) -> (ChildEvent)) -> ChildNotifier where ChildNotifier : Notifier, ChildNotifier.Event == ChildEvent
}
[!] The Podfile contains framework or static library targets (App-Metrics), for which the Podfile does not contain host targets (targets which embed the framework).
If this project is for doing framework development, you can ignore this message. Otherwise, add a target to the Podfile that embeds these frameworks to make this message go away (e.g. a test target).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Metrics` to `Target Support Files/Pods-App-Metrics/Pods-App-Metrics.debug.xcconfig` or include the `Target Support Files/Pods-App-Metrics/Pods-App-Metrics.debug.xcconfig` in your build configuration (`Metrics/Sources/ios.xcconfig`).
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base
@opsb
opsb / elm-cache-add.sh
Last active November 4, 2021 18:43
Pulls all elm.json dependencies from github and saves in local cache (requires jq to be installed)
#!/bin/sh
set -e
if [ "$(elm --version)" != "0.19.1" ]; then
echo "Globally installed elm 0.19.1 is required"
exit 1
fi
export packages=~/.elm/0.19.1/packages
### Keybase proof
I hereby claim:
* I am opsb on github.
* I am opsb (https://keybase.io/opsb) on keybase.
* I have a public key ASBg7PHvykg451W-HQfK-YRqt-SEdI111bE8iELEjsndZQo
To claim this, I am signing this object:
module View.Grid exposing (view)
import Element exposing (Element, column, el, fill, row, spacing, width)
import List.Extra
type alias Config =
{ itemsPerRow : Int
, horizontalSpacing : Int
, verticalSpacing : Int