Skip to content

Instantly share code, notes, and snippets.

View fuzzyweapon's full-sized avatar
🎯
Focusing

Julia fuzzyweapon

🎯
Focusing
View GitHub Profile
@fuzzyweapon
fuzzyweapon / django-problems.md
Created October 11, 2014 21:32
Django Problems

error: Unable to find vcvarsall.bat

@fuzzyweapon
fuzzyweapon / index.md
Last active August 29, 2015 14:09
Atom Package Cheat Sheets

Project Manager

A package for saving your projects for fast and easy access.

@fuzzyweapon
fuzzyweapon / LINKS.md
Last active December 1, 2017 01:20
Working with cygwin
/*
* Copyright 2018 Nicholas Bilyk
*
* 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
@fuzzyweapon
fuzzyweapon / changingProjectSourceLayout.kts
Last active July 5, 2018 17:52
Gradle - Kotlin DSLisms
// Sub-project or project build.gradle.kts
// This is for KotlinJVM and KotlinJVM multiplatform build.gradle.kts
java.sourceSets["main"].withConvention(KotlinSourceSet::class) {
kotlin.srcDir(file("src"))
}
java.sourceSets["test"].withConvention(KotlinSourceSet::class) {
kotlin.srcDir(file("test"))
}
pluginManagement {
// ...
resolutionStrategy {
eachPlugin {
// plugin substitution
if (requested.id.id == "com.android.application") {
useModule("com.android.tools.build:gradle:${requested.version}")
}
// plugin version substitution
if (requested.id.id.startsWith("org.jetbrans.kotlin")) {
/**
* Returns `this` value if it satisfies the given [predicate] or `null`, if it doesn't.
*/
@kotlin.internal.InlineOnly
@SinceKotlin("1.1")
public inline fun <T> T.takeIf(predicate: (T) -> Boolean): T? {
contract {
callsInPlace(predicate, InvocationKind.EXACTLY_ONCE)
}
return if (predicate(this)) this else null
@fuzzyweapon
fuzzyweapon / pretty-tasks.build.gradle.kts
Created October 13, 2018 01:12
Helper function for making registering callsites pretty.
// --- Utility functions -----------------------------------------------
inline fun <reified T : Task> task(noinline configuration: T.() -> Unit) =
tasks.registering(T::class, configuration)
// Usage
val customInstallation by task<Copy> {
description = "Copies latest gradle-kotlin-dsl snapshot over the custom installation."
dependsOn(copyCurrentDistro)
from(distribution)
into("$customInstallationDir/lib")
@fuzzyweapon
fuzzyweapon / load-env-posix.sh
Last active May 22, 2019 22:59
Load a .env file - environment variable flat files
set -a; . conf-file; set +a
@fuzzyweapon
fuzzyweapon / test-stdin-programmatic.sh
Created May 22, 2019 23:03
Set stdin programatically for a bash file. Useful for testing
set -- each one of us is a part of STDIN