Skip to content

Instantly share code, notes, and snippets.

View lbarqueira's full-sized avatar

Luis Barqueira lbarqueira

View GitHub Profile
@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@aammd
aammd / ListToDf.md
Last active March 26, 2024 23:31
turning a named list into a dataframe using dplyr

Is there an easy way to convert a named list into a dataframe, preserving the elements of the list in a "list-column"?

    library(dplyr)
    library(magrittr)

    ## make a random matrix
    rand_mat <- function() {
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active July 16, 2024 15:33
Vanilla JavaScript Quick Reference / Cheatsheet
---
title: "World maps"
output:
html_document:
df_print: paged
---
```{r echo = FALSE, message = FALSE}
library(tidyverse)
library(sf)
@akueisara
akueisara / design_patterns.md
Last active March 19, 2024 05:57
Design Patterns by University of Alberta

Design Patterns

Week 1

1. Gang of Four's Pattern Catalogue

Design Patterns: Elements of Reusable Object-Oriented Software – Gamma, Helm, Johnson, and Vlissides

2. Categories of Patterns

@norwegianblueparrot
norwegianblueparrot / bourtange.R
Last active November 25, 2023 03:40
A script to produce a 3D render of Fort Bourtange from LiDAR data
## ----setup,include=FALSE,message=FALSE,warning=FALSE-----------------------------------------------------------------------------------------------------------------------------------------------------
library("here") # 1.0.1
library("sf") # 1.0-14
library("rgl") # 1.2.1
library("geoviz") # 0.2.2
library("raster") # 3.6-26
library("rayshader") # 0.35.7
library("osmdata") # 0.2.5
library("tidyverse") # 2.0.0
@tylermorganwall
tylermorganwall / submarine_cable_map.R
Last active July 6, 2024 21:07
Submarine Cable Map Dataviz
library(geojsonsf)
library(sf)
library(rayrender)
#Data source: https://github.com/telegeography/www.submarinecablemap.com
cables = geojson_sf("cable-geo.json")
cablescene = list()
counter = 1
for(i in 1:length(cables$geometry)) {
@hvisser
hvisser / MaterialConversions.kt
Last active May 15, 2024 09:16
Using both Material 3 and material components in Compose within the same theme
// conversions based on https://material.io/blog/migrating-material-3, deprecated colors set to Colors.Red
@Composable
fun fromMaterial3Theme(isLight: Boolean): Colors {
val scheme = MaterialTheme.colorScheme
return Colors(
primary = scheme.primary,
primaryVariant = Color.Red,
secondary = scheme.secondary,
secondaryVariant = Color.Red,
background = scheme.background,
@tylermorganwall
tylermorganwall / glowing_contours.R
Created February 24, 2023 02:29
Glowing Contours in R
library(rayshader)
volcano |>
height_shade() |>
plot_3d(volcano,zscale=3)
render_contours(volcano, clear_previous = T, offset=1,color="purple",
zscale=3, nlevels = 20)
for(i in 1:360) {
library(tidyverse)
library(eurostat)
library(countrycode)
library(gt)
library(gtExtras)
data <- get_eurostat("prc_hicp_manr", filters = list(coicop = "CP00"))
ea.avg <- data |> filter(geo == "EA") |> slice_max(time, n=1) |> pull(values)