Untested
import okio.*
import okio.ByteString.Companion.encodeUtf8
import org.snakeyaml.engine.v2.api.YamlUnicodeReader.CharEncoding
import org.snakeyaml.engine.v2.api.YamlUnicodeReader.CharEncoding.*
import kotlin.jvm.JvmName
/**
import org.gradle.api.Named | |
import org.gradle.api.NamedDomainObjectContainer | |
import org.gradle.api.SupportsKotlinAssignmentOverloading | |
import org.gradle.api.model.ObjectFactory | |
import org.gradle.api.plugins.ExtensionAware | |
import org.gradle.api.provider.Property | |
import org.gradle.api.provider.Provider | |
import org.gradle.api.tasks.Input | |
import org.gradle.api.tasks.Internal | |
import org.gradle.api.tasks.Nested |
Untested
import okio.*
import okio.ByteString.Companion.encodeUtf8
import org.snakeyaml.engine.v2.api.YamlUnicodeReader.CharEncoding
import org.snakeyaml.engine.v2.api.YamlUnicodeReader.CharEncoding.*
import kotlin.jvm.JvmName
/**
Kotlin/Native requires that C libraries are compiled with a specific verison of GCC.
You can use the GCC used by Kotlin/Native itself. These Gradle tasks will help with this.
// build.gradle.kts
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Kotlin/Native has a utility, run_konan
, that can be used to compile C/C++ code.
I've written two Gradle tasks, RunKonanClangTask
and RunKonanClangTask
, that can be used to compile JoltC. A lot of credit goes to https://github.com/michal-z for writing C wrappers for Jolt!
This Gist is very scrappy, and is missing a lot of information.
.konan
dir can be retrieved from a KGP util function, the path to konan_run
file must be set manually (e.g. kotlin-native-prebuilt-windows-x86_64-1.9.0
) - is it possible to make this automatic?Hot new strat for defining type-union properties in Kotlin/JS
// SomeConfig is an external TypeScript interface
// it has a property with a type-union type, but don't implement it as a member...
external interface SomeConfig {
// multiProp: number | string | Extension | ((string) => Extension | null)
}
Stop the Dropbox icon from re-appearing in the Windows 10 taskbar notification area.
Every time Dropbox updates it overrides my preference and moves its icon from the 'hidden' icons to the always-visible icons.
I've written hide_dropbox_icon.ps1, a Powershell script that will undo this forced option, and make the Dropbox icon hidden.
public static Set<Rule> getRules(final GraphQLRuleService ruleService) { | |
final Set<Rule> rules = new HashSet<>(); | |
// validate name not blank | |
rules.add(ruleService.stringNonBlank(UserRegisterMutator.REGISTER_ARGUMENT_NAME, "name")); | |
return rules; | |
} |
@Component | |
public class UserRegisterMutator { | |
public static final String REGISTER_ARGUMENT_NAME = "userRegisterRequest"; | |
/** | |
* @param userRegisterRequest Contains info about the user's registration, e.g. their name | |
* | |
* @return Always returns true, so potential attackers get no info. Valid attempts will get an email. | |
*/ |
@Autowired | |
public GraphQlSampleController(final GraphQLRuleService ruleService) { | |
// Schema generated from query classes | |
GraphQLSchema schemaFromAnnotated = new GraphQLSchemaGenerator()// | |
// setup the schema | |
// ... | |
.generate(); | |
// set up field validation |
@Service | |
public class GraphQLRuleService { | |
// fetches messages from appropriate .prop file | |
@Autowired | |
private final MessagesService messagesService; | |
public RuleSingle stringNonBlank(final String argumentName, final String fieldName) { | |
return new RuleSingle() { | |
@Override | |
public Optional<GraphQLError> applySingle(FieldAndArguments fieldAndArguments, FieldValidationEnvironment environment) { |