Skip to content

Instantly share code, notes, and snippets.

View Gitart's full-sized avatar
🎨
Working from home

Arthur Savage Gitart

🎨
Working from home
  • ART TECH
  • Ukraine
  • 02:24 (UTC +03:00)
View GitHub Profile
<html>
<head>
<title>Demo</title>
</head>
<body>
<p>Welcome to CORS demo</p>
<script type="text/javascript">
async function invokeAPI() {
var result = await fetch('http://localhost:3000/ping')
@indraniel
indraniel / Makefile
Last active June 11, 2022 20:25
A template to start a common-lisp project inside a separate "virtual environment"
.PHONY: init-project repl deps
#https://stackoverflow.com/a/23324703 (gets the absolute directory of the Makefile)
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
QUICKLISP_DIR := $(ROOT_DIR)/quicklisp
UTILS_DIR := $(QUICKLISP_DIR)/utils
SBCL := $(HOME)/sw/cl/sbcl/2.0.3/bin/sbcl
SWANK_HOST := "127.0.0.1"
@Gitart
Gitart / json_to_instances.go
Created January 12, 2020 15:47 — forked from jochasinga/json_to_instances.go
How to convert JSON blob into an array of instances
package main
import (
"encoding/json"
"fmt"
)
type Person struct {
Name string
Age int
@OmisNomis
OmisNomis / GoRPCTutorial4.go
Created April 19, 2018 08:33
Go RPC Tutorial
package main
import (
"log"
"net/rpc"
)
type ToDo struct {
Title, Status string
}
@gghughunishvili
gghughunishvili / example.md
Last active March 28, 2024 17:10 — forked from sdnts/example.md
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});
@ljharb
ljharb / array_iteration_thoughts.md
Last active May 22, 2024 09:22
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@evalphobia
evalphobia / README.md
Last active February 22, 2024 18:28
Golang Benchmark: gob vs json

tl;dr

  • JSON is faster for small size data
    • map (key size < 50 and Unmarshalling intensive workload)
    • single struct
  • gob is faster for big size data
    • map (key size > 50 or Marshalling intensive workload)
    • slice

(old) about

@tagplus5
tagplus5 / imageToText.gs
Created December 18, 2015 18:02
google apps script image to text ocr
function doGet(request) {
if (request.parameters.url != undefined && request.parameters.url != "") {
var imageBlob = UrlFetchApp.fetch(request.parameters.url).getBlob();
var resource = {
title: imageBlob.getName(),
mimeType: imageBlob.getContentType()
};
var options = {
ocr: true
};
@yowu
yowu / HttpProxy.go
Last active July 23, 2024 23:01
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@gregorynicholas
gregorynicholas / email-spreadsheet-as-pdf-invoice.js
Last active April 14, 2023 22:18
google apps script to email a spreadsheet as a pdf invoice
/** Returns a PDF object based on the contents of the 'invoicing' sheet */
function invoiceToPDF(invDetails)
{
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
ssID = spreadsheet.getId();
var sheet = spreadsheet.getSheetByName(INVOICES_SHEETNAME);
var gid = sheet.getSheetId();
// &gid=x at the end of above url if you only want a particular sheet
var url2 = "http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=" + ssID +