Skip to content

Instantly share code, notes, and snippets.


Danilo Araújo Silva Danilo-Araujo-Silva

View GitHub Profile
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"
# 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 / 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 ->
output.add(property.get(t) as Y)
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:
View Overriding Material UI styles with Styled

For example, to override the AppBar ( root class we can do the following:

First method (override Material UI classnames):

1 - Add the property classes in the AppBar component:

    <AppBar classes={{root: 'my-root-class'}}
Danilo-Araujo-Silva / class-utils.js
Last active Dec 24, 2017
hasClass, addClass, removeClass, toggleClass implementation in ES6
View class-utils.js
* @param classNames
* @param className
* @returns {boolean}
export function hasClass(classNames, className) {
return new RegExp(` ${className} `).test(` ${classNames} `)
Danilo-Araujo-Silva / commands.txt
Last active Mar 20, 2017
Install Latest NPM and NodeJS and Update All Global NPM packages
View commands.txt
# Official documentation:
# First install npm using the link above (if you don't have it yet). Then:
# sudo is needed for some OSes, if it is not required on yours then you can remove it from the commands.
sudo npm install npm@latest -g
#Important! The option -f is used to force clean the npm cache. Take care about it. Anyway, I usually do this when I would like to install the latest NodeJS.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Danilo-Araujo-Silva / commands.txt
Last active Mar 20, 2017
Install Latest Ruby, Rails and Update All Gems
View commands.txt
# Official rvm documentation:
gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL | bash
rvm install ruby --latest
gem install rails
View Sass jquery-like extend
/// jQuery-style extend function
/// About `map-merge()`:
/// * only takes 2 arguments
/// * is not recursive
/// @param {Map} $object - first map
/// @param {ArgList} $objects - other maps
/// @param {Bool} $deep - recursive mode
/// @return {Map}
@function extend($object, $objects.../*, $deep */) {
$last: nth($objects, -1);
View Sass map-deep-get
/// Map deep get
/// @author Hugo Giraudel
/// @access public
/// @param {Map} $map - Map
/// @param {Arglist} $keys - Key chain
/// @return {*} - Desired value
@function map-deep-get($map, $keys...) {
@each $key in $keys {
$map: map-get($map, $key);
View Sass map-deep-set
/// Deep set function to set a value in nested maps
/// @author Hugo Giraudel
/// @access public
/// @param {Map} $map - Map
/// @param {List} $keys - Key chaine
/// @param {*} $value - Value to assign
/// @return {Map}
@function map-deep-set($map, $keys, $value) {
$maps: ($map,);