Skip to content

Instantly share code, notes, and snippets.

View cgruber's full-sized avatar

Christian Edward Jackson-Gruber cgruber

View GitHub Profile
@cgruber
cgruber / constrain_desktop_window.kt
Last active April 21, 2024 11:30
Constrain Compose Desktop Window to a minimum size.
//
// Copyright (c) Christian Gruber, All Rights Reserved
//
// Licensed for use under any of simplified BSD 2-clause, BSD, MIT, or Apache licenses,
// at the licensee's discretion.
//
// I'd release it to the public domain, except that prevents its use in some commercial
// environments due to the US having a broken copyright system. So there it is. Liberally
// licensed as I can make it.
@cgruber
cgruber / bazel_test_env.sh
Last active September 25, 2020 23:12
Bazel test environment variables (sanitized)
# A quick list of bazel test environment variables (as of Bazel 3.5.0)
# http://tiny.cc/bazel_test_env
#
# Some cautions and notes:
# - not a real shell file - just set it as .sh because they're written as shell env vars here.
# - This comes from java_test and kt_jvm_test. It might not reflect go_test, etc.
# - Your username is "yourusername" here.
# - the real hash of your project in bazel is replaced by deadbeefdeadbeefdeadbeefdeadbeef
# - local target/binary/package paths have been replaced by "your/package" and
# "your/package/SomeTest" as appropriate
@cgruber
cgruber / jackson_yaml_configuration.kt
Last active September 16, 2020 18:04
Exposing DumperOptions in Jackson's YAML handling.
// See article for context: http://www.geekinasuit.com/2020/09/jackson-yaml-and-kotlin-data-classes.html
// Licensed under the MIT license described here: https://choosealicense.com/licenses/mit/
// Copyright (c) Square, Inc.
val jacksonMapper = YAMLMapper(MyYAMLFactory()).apply {
registerModule(KotlinModule())
setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
}
)
@cgruber
cgruber / cgruber-iCLA.md
Last active September 6, 2019 17:09
Individual Contributor License Agreement for Christian Gruber's personal projects.

Christian Gruber's Individual Contributor License Agreement

In order to clarify the intellectual property license granted with Contributions from any person or entity, Christian Gruber (Christian) must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Christian; it does not change your rights to use your own Contributions for any other purpose.

You accept and agree to the following terms and conditions for Your present and

@cgruber
cgruber / keybase.md
Created August 5, 2019 17:37
keybase.md

Keybase proof

I hereby claim:

  • I am cgruber on github.
  • I am geekinasuit (https://keybase.io/geekinasuit) on keybase.
  • I have a public key ASBhmg2ZlIRVTG6CyDjfgLgX15_AAANhg4mnzF9Clyd6LAo

To claim this, I am signing this object:

@cgruber
cgruber / pom.xml
Last active September 11, 2017 12:08
Example enforcer rule to exclude commons-collections 3.2.1 from the build
<!-- Avoid the M.A.D. Gadget vulnerability in certain apache commons-collections versions -->
<project>
<!-- ... -->
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals><goal>enforce</goal></goals>
@cgruber
cgruber / JUNG_PROJECT_CLA.md
Last active February 5, 2016 20:08
The JUNG Project Individual CLA

JUNG Individual Contributor License Agreement

In order to clarify the intellectual property license granted with Contributions from any person or entity, the JUNG Project must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms of the JUNG Project. This license is for your protection as a Contributor as well as the protection of the JUNG Project and its owners; it does not change your rights to use your own Contributions for any other purpose.

You accept and agree to the following terms and conditions for Your present and future

@cgruber
cgruber / gist:5b3a4f10d88d04154e89
Last active August 29, 2015 14:09
Component exporting to dependent components
interface SingletonsToExport {
SomeService someService();
OkHttpClient httpClient();
GooglePlayThingamabob playThingy();
}
@Singleton
@Component(...)
interface ApplicationComponent extends SingletonsToExport {
void inject(MyApplication app);
class Foo {
@AutoFactory
Foo(@Provider bar, String aString) {...}
}
@Generated(...AutoFactoryProcessor.class)
final class FooFactory {
...
public Foo create(String s) { ... }
}
@cgruber
cgruber / AbstractPump$InjectAdapter
Last active December 10, 2015 16:48
Generated Classes for Dagger for comparison between old and new generation code.
//Code generated by dagger-compiler.
package coffee;
import dagger.internal.Binding;
import dagger.internal.Linker;
import dagger.MembersInjector;
import java.util.Set;
/**