Skip to content

Instantly share code, notes, and snippets.

@Albertoimpl
Albertoimpl / agify.json
Created June 6, 2022 10:54
OpenAPI-test
[
{
"openapi": "3.0.1",
"info": {
"title": "agifyApis",
"description": "defaultDescription",
"version": "0.1"
},
"servers": [
{
@Albertoimpl
Albertoimpl / CrossBrowserTest.java
Created October 17, 2018 10:03 — forked from beatngu13/CrossBrowserTest.java
Dead-simple cross-browser testing with Selenium and JUnit 5 parameterized tests
package my.package;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.openqa.selenium.WebDriver;
class CrossBrowserTest {
@ParameterizedTest
@MethodSource( "my.package.WebDriverFactory#drivers" )
#!/bin/bash
set -uo pipefail
function check_s3_status() {
S3_BUCKET_STATUS=$(curl -I https://my-buckets.s3.amazonaws.com | head -n 1)
[[ ${S3_BUCKET_STATUS} == *"HTTP/1.1 200 OK"* ]] && echo "OK with code: ${S3_BUCKET_STATUS}" && return 0
echo "Failed with code: ${S3_BUCKET_STATUS}"
return 1
}
@Albertoimpl
Albertoimpl / Code.gs
Created September 12, 2016 18:17
Export JSON Translations
function onInstall(e) {
onOpen(e);
}
function onOpen(e) {
var jsonExport = [{name: "Export as JSON translation files", functionName: "runJSONExport"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu("json", jsonExport);
}
function runJSONExport() {
@Albertoimpl
Albertoimpl / JavaTrampoline.java
Last active March 3, 2023 17:49
Java 8 Trampoline for Tail Call Recursion
import java.math.BigInteger;
public class TailCallRecursion {
@FunctionalInterface
public interface Trampoline<V> {
V trampoline();
default V call() {
@Albertoimpl
Albertoimpl / tailcall.rb
Created November 26, 2015 14:54
Ruby enabling tail recursion
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
}
eval <<END
def factorial_tailcall(n, accumulated=1)
return accumulated if n <= 1
factorial_tailcall(n - 1, n * accumulated)
end
@Albertoimpl
Albertoimpl / Method Swizzle
Created February 9, 2015 18:13
A basic example of method swizzle
#import <objc/runtime.h>
@implementation UIViewController (Tracking)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];