| marp | author | title | paginate |
|---|---|---|---|
true |
Zack Kite |
DDD in Practice |
true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func readJson[T any](w http.ResponseWriter, r *http.Request) (T, error) { | |
| maxBytes := 1_048_576 | |
| r.Body = http.MaxBytesReader(w, r.Body, int64(maxBytes)) | |
| dec := json.NewDecoder(r.Body) | |
| dec.DisallowUnknownFields() | |
| var dst T | |
| if err := dec.Decode(&dst); err != nil { | |
| return dst, err |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace FunctionalExtensions | |
| { | |
| [Serializable] | |
| public abstract class ValueObject : IComparable, IComparable<ValueObject> | |
| { | |
| private int? _cachedHashCode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # export mysql database | |
| mysqldump -u username -p database_name > data-dump.sql | |
| # Check if a sql script is a legit sql dump file | |
| head -n 5 prodbck_anon_reduced.sql | grep dump ; echo $? | |
| # import | |
| mysql -u root -p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Console { | |
| def putStrLn(str: => String) = TIO.effect(println(str)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class BusinessResult | |
| { | |
| public const SUCCESS = "success"; | |
| public const FAIL = "fail"; | |
| private string $result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function curry(fn) { | |
| return function curriedFn(...args) { | |
| if (fn.length !== args.length) { | |
| return curriedFn.bind(null, ...args); | |
| } | |
| return fn.apply(null, args); | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- \/\/\/ DO NOT MODIFY THE FOLLOWING LINES \/\/\/ | |
| module ReversiAI (State,author,nickname,initial,think) where | |
| import Reversi | |
| import Data.List | |
| import Data.Map (fromList, (!)) | |
| import Data.Maybe | |
| -- /\/\/\ DO NOT MODIFY THE PRECEDING LINES /\/\/\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import math | |
| import random | |
| import shutil | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from time import time | |
| from functional import seq | |
| from collections import namedtuple | |
| import keras |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from keras.models import Model | |
| layer_outputs = [layer.output for layer in model.layers] | |
| activation_model = Model(inputs=model.input, outputs=layer_outputs) | |
| activations = activation_model.predict(X_train[10].reshape(1,28,28,1)) | |
| def display_activation(activations, col_size, row_size, act_index): | |
| activation = activations[act_index] | |
| activation_index=0 | |
| fig, ax = plt.subplots(row_size, col_size, figsize=(row_size*2.5,col_size*1.5)) |
NewerOlder