Skip to content

Instantly share code, notes, and snippets.

View AniFichadia's full-sized avatar

Aniruddh Fichadia AniFichadia

  • Melbourne, Australia
View GitHub Profile
@AniFichadia
AniFichadia / $KtorReverseProxy.kt
Last active January 25, 2025 02:57
Ktor reverse proxy that forwards the entire request contents (including the body). This is based off https://github.com/ktorio/ktor-samples/blob/1.3.0/other/reverse-proxy/src/ReverseProxyApplication.kt
package com.anifichadia.ktorreverseproxy
import io.ktor.application.Application
import io.ktor.application.ApplicationCallPipeline
import io.ktor.application.ApplicationStopping
import io.ktor.application.call
import io.ktor.application.install
import io.ktor.application.log
import io.ktor.client.HttpClient
import io.ktor.client.features.HttpTimeout
@AniFichadia
AniFichadia / SkipOnFirstFailureTestRule.kt
Last active May 6, 2025 15:57
JUnit classes that skip subsequent tests if any test in a test suite fails
import org.junit.internal.AssumptionViolatedException
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
/**
* @author Aniruddh Fichadia
* @date 2020-04-03
*/
class SkipOnFirstFailureTestRule(
@AniFichadia
AniFichadia / Quick & Dirty Meetup.com Raffle.js
Last active August 29, 2015 14:24
A quick and dirty meetup raffle. Just run it through your browser console on your meetups event page before it ends to draw a random winner. If the event has ended, use the commented code at the top of the Gist to retrieve more attendees. There's no dependencies since it uses the scripts included by meetup.com
// If you need it, use this to get more meetup attendee. eg. after an event.
// This should run and complete it's operation before running the other code
// $('a.nav-appendPager').click();
// Get the attendees list, this excludes members who haven't RSVP'd
var attendees = $('.event-attendees .member-name a');
var attendeesCount = attendees.length;
// Draw a random winner
var winner = attendees[Math.floor(Math.random() * attendeesCount)].text;