Skip to content

Instantly share code, notes, and snippets.

View sgobotta's full-sized avatar
:octocat:
(🎧) => ╭( 👁️◡👁️ )/

Santiago Botta sgobotta

:octocat:
(🎧) => ╭( 👁️◡👁️ )/
View GitHub Profile
{
"root": true,
"env": {
"node": true,
"es6": true
},
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
@sgobotta
sgobotta / paginatedGrid.js
Last active March 20, 2020 16:43
A react gist for paginated grids, using react hooks.
export default function GridScreen() {
const [isFetchingComplete, setFetchingComplete] = React.useState(false);
const [tweetsState, setTweetsState] = React.useState({
// initialises an empty array for tweets results
results: [],
})
// The API url should go here. E.g: http://localhost:8000
const hostUrl = '...'
// descendant order, depends on the node backend implementation - @sgobotta
const sortParam = `sort=-created_at`
@sgobotta
sgobotta / nodejs.yml
Created April 17, 2020 23:41
Example Github Action script for static node websites deployment on Dokku
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ my-target-branch ]
jobs:
@sgobotta
sgobotta / first.erl
Last active May 5, 2020 22:35
Gists for the FeatureLearn Erlang course (1.9)
-module(first).
-export([
double/1,
mult/2,
area/3,
square/1,
trbl/1,
sum/3
]).
@sgobotta
sgobotta / pattern_matching.erl
Last active May 7, 2020 13:51
Gist for the FeatureLearn Erlang course (1.15)
% @doc Pattern Mathing module for the 1.15 step of the FutureLearn Erlang Course.
-module(pattern_matching).
-export([
xOr/2,
xOr1/2,
xOr2/2,
xOr3/2,
xOr4/2,
max_three/3,
@sgobotta
sgobotta / recursion.erl
Created May 7, 2020 23:38
Gist for the FeatureLearn Erlang course (2.3)
-module(recursion).
-export([fib/1, fibs/1, pieces/1]).
%% @doc given an integer computes it's position in the fibonacci sequence
fib(0) -> 0;
fib(1) -> 1;
fib(X) -> fib(X-1) + fib(X-2).
%% @doc given a fibonacci sequence position returns the sum of fibonacci computations
fibs(X) -> 1 + 1 + fibs(X-1) + fibs(X-2).
@sgobotta
sgobotta / recursion.erl
Last active May 7, 2020 23:43
Gist for the FeatureLearn Erlang course (2.5) "Tail Recursion"
-module(recursion).
-export([
fib/1,
test_fib/0,
is_perfect_number/1,
test_is_perfect_number/0
]).
fib(N) -> fib(N,0,1).
@sgobotta
sgobotta / list.erl
Created May 16, 2020 23:37
Gist for the FeatureLearn Erlang course (2.15) "Defining functions over lists in practice"
-module(list).
-export([
product_dr/1, test_product_dr/0,
product_tr/1, test_product_tr/0,
maximum_dr/1, test_maximum_dr/0,
maximum_tr/1, test_maximum_tr/0
]).
%% @doc Given a list of numbers returns the product of it's elements.
%% The case base should return 1 since it's the neutral element of the
@sgobotta
sgobotta / list.erl
Created May 17, 2020 19:58
Gist for the FeatureLearn Erlang course (2.18) "Constructing lists with recursive functions"
-module(list).
-author("@sgobotta").
-export([
double_dr/1, test_double_dr/0,
double_tr/1, test_double_tr/0,
evens_dr/1, test_evens_dr/0,
evens_tr/1, test_evens_tr/0,
median/1, test_median/0,
maximum_dr/1, test_maximum_dr/0,
maximum_tr/1, test_maximum_tr/0,