set version to 6.0.13
export MONGOMS_VERSION=6.0.13
set version to 6.0.13
export MONGOMS_VERSION=6.0.13
type DBTX interface { | |
ExecContext(context.Context, string, ...interface{}) (sql.Result, error) | |
PrepareContext(context.Context, string) (*sql.Stmt, error) | |
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) | |
QueryRowContext(context.Context, string, ...interface{}) *sql.Row | |
} | |
func DBTxFromGorm(tx *gorm.DB) (DBTX, bool) { | |
dbtx, ok := tx.Statement.ConnPool.(*sql.Tx) | |
return dbtx, ok |
const prismaClient = new PrismaClient({ | |
log: ['query'] // must enable this to log | |
}); | |
// Log slow query with all parameters in place, | |
// so you can copy pasted it and do EXPLAIN query | |
prismaClient.$on('query' as any, (e: any) => { | |
const dur = Number.parseInt(e?.duration); | |
const maxQueryTime = 100; // in ms | |
if (dur <= maxQueryTime) return; |
# add your ssh public key to github & gitlab | |
# set GOPRIVATE, for github & gitlab | |
GOPRIVATE="gitlab.com/<your-private-group>,github.com/<your-private-group>" | |
# if you use a private hosted gitlab | |
GOPRIVATE="gitlab.yoursite.com" | |
# set github to use ssh | |
git config --global url."git@github.com:".insteadOf "https://github.com/" |
package cryptor | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/hex" | |
"fmt" | |
"io" | |
) |
javascript:(function() {function copyToClipboard(text) { if (window.clipboardData && window.clipboardData.setData) { /*IE specific code path to prevent textarea being shown while dialog is visible.*/ return clipboardData.setData("Text", text); } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { var textarea = document.createElement("textarea"); textarea.textContent = text; textarea.style.position = "fixed"; /* Prevent scrolling to bottom of page in MS Edge.*/ document.body.appendChild(textarea); textarea.select(); try { return document.execCommand("copy"); /* Security exception may be thrown by some browsers.*/ } catch (ex) { console.warn("Copy to clipboard failed.", ex); return false; } finally { document.body.removeChild(textarea); } }}var markdown = '[' + document.title + '](' + window.location.href + ')';var selection = window.getSelection( |
FROM nginx:alpine | |
COPY ./build /usr/share/nginx/html | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
const path = require('path') | |
const fs = require('fs') | |
const express = require('express') | |
const bodyParser = require('body-parser') | |
const multer = require('multer'); | |
const crypto = require('crypto'); | |
const db = require('./db/db.json') |
// with empty New(), you should use regex `(.+)` and escape the `$` using `\\` | |
db, mock, _ := sqlmock.New() | |
mock.ExpectQuery("SELECT (.+) FROM \"ARTICLES\" WHERE \"SLUG\" = \\$1"). | |
WithArgs("foobar"). | |
WillReturnRows( | |
sqlmock.NewRows(columns).AddRow( | |
"28e8a227-4ebd-43b8-9631-108392ed2ba8", | |
"foobar", | |
"Foobar", | |
"Body foobar", |
// AuthHandler handle user auth | |
type AuthHandler interface { | |
Authorize(w http.ResponseWriter, r *http.Request) | |
Login(w http.ResponseWriter, r *http.Request) | |
} | |
type authHandler struct { | |
userService app.UserService | |
} |