Skip to content

Instantly share code, notes, and snippets.

@mtsmfm
mtsmfm / background.js
Created May 31, 2021 15:21
tabCapture with v3 manifest
chrome.action.onClicked.addListener(() => {
console.log(chrome.tabCapture);
});
class LpGen
INFINITY = Float::INFINITY
module HasMembers
def set_coefficient(var, x)
members << Member.new(var, x)
end
def members
@members ||= []
@mtsmfm
mtsmfm / report.rb
Last active December 11, 2020 11:17
Report N+1 via New Relic API
require 'net/http'
require 'uri'
require 'json'
require 'time'
require 'csv'
class NrqlClient
def initialize(api_key:, account_id:)
@api_key = api_key
@account_id = account_id
@mtsmfm
mtsmfm / rewrite.go
Created November 24, 2020 01:48
rewrite.go
package main
import (
"go/ast"
"go/format"
"go/parser"
"go/token"
"io/ioutil"
"log"
"os"
$ DATABASE_URL=postgres://postgres:password@postgres/postgres?sslmode=disable go run utils/foo.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x68e9dc]
goroutine 1 [running]:
github.com/ericlagergren/decimal.(*Big).IsNaN(...)
/home/app/go/pkg/mod/github.com/ericlagergren/decimal@v0.0.0-20181231230500-73749d4874d5/big.go:853
github.com/volatiletech/sqlboiler/v4/types.decimalValue(0x0, 0x8fe300, 0x0, 0x0, 0x7fa1a03ebca0, 0x8a9601)
/home/app/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.2.0/types/decimal.go:140 +0x3c
github.com/volatiletech/sqlboiler/v4/types.Decimal.Value(0x0, 0xc0001a15f0, 0x40d1e5, 0x6c4760, 0x7007c0)
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'mongoid'
end
require 'yaml'
require 'tempfile'
class ArticleEntity < ArticleCommonEntity; end
def as_json
{id: @article.id, thumbnail_url: @article.thumbnail_url}
end
end
get "/articles" do
Article.all.map {|a| ArticleEntity.new(a) }.to_json
end
const postQuery = async <TData, TVariables>(query: string, variables: TVariables) => {
const token = await firebase.auth().currentUser!.getIdToken();
const resonse = await fetch('/graphql', {
method: 'POST',
body: JSON.stringify({ query, variables })
});
const json: { data: TData, errors: Array<any> | undefined } = await resonse.json();
const postQuery = async <TData, TVariables>(query: string, variables: TVariables) => {
const token = await firebase.auth().currentUser!.getIdToken();
const resonse = await fetch('/graphql', {
method: 'POST',
credentials: 'include',
headers: {
'content-type': 'application/json',
'authorization': `Bearer ${token}`,
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]')!.getAttribute('content')!
2020/05/24 10:12:22 Doing playback at 10.00x speed
2020/05/24 10:12:22 Preprocessing file
2020/05/24 10:13:22 Preprocess complete
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly
2020/05/24 10:14:10 context.Execute error: error executing op: Closed explicitly