Skip to content

Instantly share code, notes, and snippets.

View DominikPalo's full-sized avatar

Dominik Paľo DominikPalo

View GitHub Profile
@DominikPalo
DominikPalo / GzipContent.cs
Created April 22, 2022 09:28
GZIP compressed HTTP content
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Text;
namespace System.Net.Http
{
public class GzipContent : ByteArrayContent
{
public GzipContent(string content, Encoding encoding, string mediaType)
@DominikPalo
DominikPalo / ArrayOfTuplesExtensions.swift
Created October 15, 2021 13:14
A Swift extension for an array containing name-value tuples to get the value of the first tuple found by name
fileprivate extension Array where Element == (String, String) {
func firstValue(name: String) -> String? {
if let tuple = self.first(where: {$0.0 == name}) {
return tuple.1
}
return nil
}
}
@DominikPalo
DominikPalo / google.script.d.ts
Last active June 10, 2022 15:13 — forked from fjmorel/google.script.d.ts
Google Apps Script client-side Typescript definitions
// Google Apps Script methods available to scripts
declare namespace google {
/**
* Methods available to Google Apps Script
*/
namespace script {
interface IRun {
[serverSideFunction: string]: Function;
/**
@DominikPalo
DominikPalo / micros.c
Last active November 9, 2017 23:35
Function to return the number of microseconds since the ESP32 board began running
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "esp_system.h"
#include "esp_attr.h"
#include "sdkconfig.h"
portMUX_TYPE microsMux = portMUX_INITIALIZER_UNLOCKED;
unsigned long IRAM_ATTR micros()
{
static unsigned long lccount = 0;