Skip to content

Instantly share code, notes, and snippets.

View FlashForge-Adventurer3-cura.gcode
--- Start GCODE
M118 X20.06 Y15.14 Z22.37 T0
M107
G90
G28
M132 X Y Z A B
G1 Z50.000 F420
G161 X Y F3300
M7 T0
M6 T0
@anderssv
anderssv / DependencyInjectionStubbedApplicationTest.kt
Created April 11, 2018 12:15
Dependency Injection Blog - test stubs
View DependencyInjectionStubbedApplicationTest.kt
app = DependencyInjectionApplicationContext(
loadConfig(true),
businessRepository = BusinessRepositoryStub()
).create()
serverUrl = app.start()
@anderssv
anderssv / DependencyInjectionApplicationConfig.kt
Created April 10, 2018 08:03
Dependency Injection Blog - Load Config
View DependencyInjectionApplicationConfig.kt
fun loadConfig(randomPort: Boolean = false): DependencyInjectionApplicationConfig {
val properties = loadRuntimeProperties()
return DependencyInjectionApplicationConfig(
if (randomPort) 0 else requiredEnv(properties, "PORT", "5000").toInt(),
requiredEnv(properties, "DATABASE_URL"),
env(properties, "DATABASE_USER")
)
}
@anderssv
anderssv / DependencyInjectionApplicationContext.kt
Last active April 10, 2018 07:01
Dependency Injection Blog - Create app
View DependencyInjectionApplicationContext.kt
/**
* The class responsible for wiring it all together
*/
class DependencyInjectionApplicationContext(
private val configuration: DependencyInjectionApplicationConfig,
private val businessRepository: BusinessRepository? = null) {
fun create(): DependencyInjectionApplication {
// Create DataSource(s)
// ...
@anderssv
anderssv / DependencyInjectionApplication.kt
Created April 10, 2018 06:46
Dependency Injection Blog - Bootstrap
View DependencyInjectionApplication.kt
fun main(args: Array<String>) {
// We load the config first resolving and checking if we have all the values we need.
val config = loadConfig()
// Then we wire up the application into objects. The variables are translated into "rich" objects like
// DataSources, Services and Repositories.
val app = DependencyInjectionApplicationContext(config).create()
// Then you start the main application code.
app.start()
@anderssv
anderssv / ytdl.sh
Created January 1, 2018 18:30
My youtube-dl default command line
View ytdl.sh
#!/bin/bash -eu
youtube-dl \
--abort-on-error \
--write-sub \
--convert-subs srt \
--embed-subs \
--sub-lang no,en \
--add-metadata \
--output '%(series)s.S%(season_number)02dE%(episode_number)02d.%(title)s.%(ext)s' $1
View gist:9c9f2960bd73c21ce4e353679c359618
### Keybase proof
I hereby claim:
* I am anderssv on github.
* I am anderssv (https://keybase.io/anderssv) on keybase.
* I have a public key whose fingerprint is EDED A7DB F6E1 C8A6 3EEA 2246 8F15 9B9B 50B5 FC56
To claim this, I am signing this object: