Skip to content

Instantly share code, notes, and snippets.

diff --git a/web/keys_controller.go b/web/keys_controller.go
index c76ba719..091ad270 100644
--- a/web/keys_controller.go
+++ b/web/keys_controller.go
@@ -18,16 +18,22 @@ type KeysController struct {
// "<application>/keys"
func (c *KeysController) Create(ctx *gin.Context) {
request := models.CreateKeyRequest{}
+
// TODO: Change CreateKeyRequest to only have one password
@dimroc
dimroc / gorm_diff_types_repro.go
Last active January 26, 2019 01:03
Reproduce issue where the underlying db will change the Scan type in `gorm`: https://github.com/jinzhu/gorm/issues/2276
package main
import (
"database/sql/driver"
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
diff --git a/services/application.go b/services/application.go
index 39573a5b..3d5c0cad 100644
--- a/services/application.go
+++ b/services/application.go
@@ -43,7 +43,7 @@ type ChainlinkApplication struct {
BulkRunDeleter SleeperTask
pendingConnectionResumer *pendingConnectionResumer
bridgeTypeMutex sync.Mutex
- jobSubscriberID, txManagerID, connectionResumerID string
+ jobSubscriberID, txManagerID, connectionResumerID int
diff --git a/services/application.go b/services/application.go
index 39573a5b..3d5c0cad 100644
--- a/services/application.go
+++ b/services/application.go
@@ -43,7 +43,7 @@ type ChainlinkApplication struct {
BulkRunDeleter SleeperTask
pendingConnectionResumer *pendingConnectionResumer
bridgeTypeMutex sync.Mutex
- jobSubscriberID, txManagerID, connectionResumerID string
+ jobSubscriberID, txManagerID, connectionResumerID int
@dimroc
dimroc / assert_on_methods.go
Last active November 19, 2018 22:35
Finding it hard to shoe horn into table driven tests
func TestHeightsController_Index(t *testing.T) {
threshold := big.NewInt(2)
tests := []struct {
name string
status int
}{
{"good clients", 200},
// Hard to do error cases without adding an if with difference setup. could add test helpers...
}
#!/usr/bin/env node
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
const countdown = async () => {
await delay(5000)
console.log("hello world")
}
countdown()
@dimroc
dimroc / reflection_intro.go
Created October 10, 2018 18:28
Experiments with golang reflection. Create an empty slice of the type passed in in a callback: https://play.golang.org/p/Zc9HiABuMi_a
package main
import (
"fmt"
"reflect"
)
func main() {
callback := func(int) bool { return false }
@dimroc
dimroc / coremltools-sample.py
Created August 28, 2018 22:35
Simple barebones coremltools conversation to Keras
coreml_model = coremltools.converters.Keras.convert(
path,
input_names=['input_1'],
image_input_names=['input_1'],
output_names=['density_map'])
coreml_model.save("CrowdPredictor.mlmodel")
@dimroc
dimroc / sync_cond_reaper.go
Last active August 21, 2018 15:43
Real use of Golang's `sync.Cond` to efficiently signal a second goroutine when to run and limit the number of reapers that can be enqueue while running to 1.
package services
import (
"sync"
"time"
"github.com/asdine/storm"
"github.com/smartcontractkit/chainlink/logger"
"github.com/smartcontractkit/chainlink/store"
"github.com/smartcontractkit/chainlink/store/models"