Skip to content

Instantly share code, notes, and snippets.

@gavin19
gavin19 / reddit_cap_comments.py
Last active July 16, 2023 15:07
Screenshot top-level reddit comments
from selenium.webdriver import Firefox, FirefoxOptions
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
import praw
from time import sleep
r = praw.Reddit(...)
opts = FirefoxOptions()
opts.add_argument("--headless")
@janojanahan
janojanahan / MonadicNullSafety.kt
Last active March 23, 2023 02:46
Kotlin Nullable can behave like a monad
/**
* A Gist proving that Kotlin's nullable type can be made into a monad without wrapping into another
* object and satisfy the Monadic laws
*
* Kotlin has comprehensive null safety built into the language enforced at compile time, using its
* nullable type.
*
* Its language structure makes dealing with nullable values simple and succinct. Unlike other language
* monadic constructs such as Option (scala), Optional(Java8+) and Maybe(Haskell), it is enforced at
* compile time and is compatible with existing non monad aware API (for example,
@nlwillia
nlwillia / ChainParser.java
Last active December 17, 2015 11:29
https://jira.springsource.org/browse/INT-3023 This is an example of how the Chain namespace parser could be extended to support embedding an inbound-channel-adapter at the top of the chain and inferring a direct channel between the adapter and the chain. The details are in the added parseInboundChannelAdapters method.
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the