Skip to content

Instantly share code, notes, and snippets.

Danilo Araújo Silva Danilo-Araujo-Silva

View GitHub Profile
View echo.sh
#!/bin/bash
#echo $@
# store arguments in a special array
args=("$@")
# get number of elements
ELEMENTS=${#args[@]}
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / mathemagika.kts
Last active Jun 17, 2020
Mathemagika Demonstration Kotlin KTS Script
View mathemagika.kts
@file:MavenRepository("mathemagika", "https://dl.bintray.com/danilo-araujo-silva/mathemagika" )
@file:DependsOnMaven("com.daniloaraujosilva:mathemagika:1.0.0")
println(zeta(2))
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / kotlin_keywords_and_symbols.kt
Created Jun 10, 2020
All Kotlin Keyworkds and Symbols in a MutableMap
View kotlin_keywords_and_symbols.kt
val kotlinKeywordsAndSymbols =
mutableListOf(
"as",
"as?",
"break",
"class",
"continue",
"do",
"else",
"false",
View FunctionLambdaCompositionInKotlin.kt
infix fun <A, B, C> ((A) -> B).andThen(g: (B) -> C): (A) -> C = { a: A -> g(this(a)) }
val c = a andThen b
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / Allowed characters in Kotlin backticks.md
Last active Jul 28, 2020
Allowed characters in Kotlin backticks
View Allowed characters in Kotlin backticks.md

Allowed characters in Kotlin backticks

Some allowed characters are

val ` -!"#$%^&()*+,-=?@^_{|}~😡` = ""

Yes, that's write, emojis are allowed too =)

Some not allowed characters are

We couldn’t find that file to show.
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / Vee Validate - Validating Child components
Last active May 13, 2020
A strategy to validate child components with Vue and Vee Validate.
View Vee Validate - Validating Child components
// Somewhere in the initialization:
import VeeValidate from "vee-validate";
Vue.use(VeeValidate);
// Then, in the parent component:
export default {
provide () {
return { parentValidator: this.$validator }
},
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / install_octave_with_gui_and_gnuplot_on_macos_mojave.txt
Last active Jul 5, 2019
Install Octave with gui and gnuplot on macOS Mojave
View install_octave_with_gui_and_gnuplot_on_macos_mojave.txt
# Install homebrew, if is not already installed:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update and upgrade homebrew, if needed:
brew update && brew upgrade
# Install XCode (it is a long download, it is an Octave dependency)
# Go to Apple Store and install.
# Install Aquaterm
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / Extension.kt
Created Oct 31, 2018
Kotlin: get a list of some property values from a collection / list of objects
View Extension.kt
import kotlin.reflect.KMutableProperty1
inline fun <reified T, Y> MutableList<T>.arrayListOfField(property: KMutableProperty1<T, Y?>): ArrayList<Y> {
val output = ArrayList<Y>()
this.forEach {t: T ->
@Suppress("UNCHECKED_CAST")
output.add(property.get(t) as Y)
}
@Danilo-Araujo-Silva
Danilo-Araujo-Silva / solution
Created Oct 30, 2018
Solution: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
View solution
To fix the error:
`xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun`
You can do:
`xcode-select --install`
More info on:
`https://apple.stackexchange.com/questions/254380/macos-mojave-invalid-active-developer-path`
You can’t perform that action at this time.