Skip to content

Instantly share code, notes, and snippets.

@pmakokluev
pmakokluev / JSON_to_URLEncoded.js
Created August 23, 2023 11:16 — forked from lastguest/JSON_to_URLEncoded.js
Convert JavaScript object to x-www-form-urlencoded format
function JSON_to_URLEncoded(element,key,list){
var list = list || [];
if(typeof(element)=='object'){
for (var idx in element)
JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list);
} else {
list.push(key+'='+encodeURIComponent(element));
}
return list.join('&');
}
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html lang="en" class=" websockets audio cssgradients contenteditable websockets audio cssgradients contenteditable websockets audio cssgradients contenteditable websockets audio cssgradients contenteditable websockets audio cssgradients contenteditable websockets audio cssgradients contenteditable websockets audio cssgradients contenteditable">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="robots" content="noindex">
<meta name="googlebot" content="noindex">
<!--<link rel="shortcut icon" type="image/x-icon" href="https://merchant.leroymerlin.ru/orders-static/favicon/favicon.ico">-->
@pmakokluev
pmakokluev / geodesicDistance.gas
Created October 11, 2022 15:46
Расстояние между двумя точками на карте, заданными с помощью географических координат
// ported 2 GAS from https://ru.stackoverflow.com/questions/289889/%D0%A0%D0%B0%D1%81%D1%81%D1%82%D0%BE%D1%8F%D0%BD%D0%B8%D0%B5-%D0%BC%D0%B5%D0%B6%D0%B4%D1%83-%D0%B4%D0%B2%D1%83%D0%BC%D1%8F-%D1%82%D0%BE%D1%87%D0%BA%D0%B0%D0%BC%D0%B8-%D0%BD%D0%B0-%D0%BA%D0%B0%D1%80%D1%82%D0%B5-%D0%B7%D0%B0%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D0%BC%D0%B8-%D1%81-%D0%BF%D0%BE%D0%BC%D0%BE%D1%89%D1%8C%D1%8E-%D0%B3%D0%B5%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85-%D0%BA%D0%BE%D0%BE%D1%80
function test_geodesicDistance() {
var gps_calc={
"183263": [
55.752368,
37.623879
],
"177951": [
59.925328,
@pmakokluev
pmakokluev / GoogleSheetJson.md
Created September 13, 2022 23:30 — forked from ronaldsmartin/GoogleSheetJson.md
Google Spreadsheet JSON Queries

SheetAsJSON + Filtering

This is an extension of DJ Adams' excellent SheetAsJSON Google Apps Script, which provides a way to GET a published Google Spreadsheet as a JSON feed. This version allows generic filtering for terms, more specific control over which rows to parse, and correct MIME type for JSONP output.

Minimal Usage

The following parameters are required for the script to work.

https://script.google.com/macros/s/AKfycbzGvKKUIaqsMuCj7-A2YRhR-f7GZjl4kSxSN1YyLkS01_CfiyE/exec?
+ id=<spreadsheet key>
+ sheet=<sheet name on spreadsheet>
@pmakokluev
pmakokluev / _jsonPuller.md
Created September 13, 2022 23:20 — forked from jalcantarab/_jsonPuller.md
A Google apps script to pull json from a spreadsheet

JSON Puller - Google Apps Script

Transforms the data of a given Spreadsheet Sheet to JSON.

  • The frozen rows are taken as keys for the JSON.
  • The data taken for the values is only that after the frozen rows

Set up:

exportJSON(Spreadsheet) - transforms the data in the given sheet to JSON.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmakokluev
pmakokluev / ozon_dbs_order
Created June 7, 2022 06:05
Пример заказа Ozon по схеме DBS
array:1 [
0 => array:19 [
"posting_number" => "60042159-0004-1"
"order_id" => 713172930
"order_number" => "60042159-0004"
"status" => "awaiting_packaging"
"delivery_method" => array:6 [
"id" => 159178
"name" => "Наша логистика"
"warehouse_id" => 23241524065000
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@pmakokluev
pmakokluev / GoogleAppsScript2GitHub.gs
Created April 29, 2022 19:24 — forked from mhawksey/GoogleAppsScript2GitHub.gs
Example script that demonstrates how you can commit files to Github using Google Apps Script. If copying into a script project remembers to add a oAuth2 library https://github.com/googlesamples/apps-script-oauth2. More info in this post https://mashe.hawksey.info/?p=17293
/*
To use you need to create an application on Github at https://github.com/settings/developers
The callback in this needs to be set to https://script.google.com/macros/d/{SCRIPT ID}/usercallback
Where {SCRIPT ID} is the ID of the script that is using this library. You can find your script's ID in the Apps Script code editor by clicking on the menu item "File > Project properties".
In this example code I've stored the apllicaitons clientId and clientSecret in the Script Properties:
- git_clientId
- git_clientSecret
@pmakokluev
pmakokluev / gist:b248b540c1bb417fab12168111218b10
Created April 25, 2022 07:30 — forked from mhawksey/gist:1170597
Google Apps Script to fill in a Document template with Spreadsheet data
function onOpen() {
var menuEntries = [ {name: "Create Diary Doc from Sheet", functionName: "createDocFromSheet"}];
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("Fitness Diaries", menuEntries);
}
function createDocFromSheet(){
var templateid = "1O4afl8SZmMxMFpAiN16VZIddJDaFdeRBbFyBtJvepwM"; // get template file id
var FOLDER_NAME = "Fitness Diaries"; // folder name of where to put completed diaries
// get the data from an individual user