Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View JRobsonJr's full-sized avatar
📣
Broadcasting the boom, boom, boom, boom and making 'em all dance to it.

Robson Junior JRobsonJr

📣
Broadcasting the boom, boom, boom, boom and making 'em all dance to it.
View GitHub Profile
@JRobsonJr
JRobsonJr / App.tsx
Last active October 22, 2022 17:49
Passo a passo do workshop de React + API Web do Spotify
import React, { useEffect, useState } from "react";
import "./App.css";
import {
Album,
getAlbum,
getArtistTopTracks,
getCurrentUserTopTracks,
init,
Page,
Track,

Clube do Livro do CCC@UFCG (Ada Lovelace)

Artes de divulgação feitas por Carmem

A mulher na janela, A. J. Finn

  • Indicado por @rodrigoec
  • Período: 28/08/20 a 18/09/20
  • Média: 6.3 😄
@JRobsonJr
JRobsonJr / tutorial-mongoose.js
Last active April 3, 2020 18:27
Usando MongoDB + Mongoose
// index.js
/* ... */
import mongoose from 'mongoose';
const uri = 'mongodb://<dbuser>:<dbpassword>@<dbhost>:<dbport>/<dbname';
mongoose.connect(uri); // Pode ter um segundo parâmetro options
const db = mongoose.connection;
db.once('open', () => console.log('Connected to the DB!'));
db.on('error', (err) => console.log(err));
partido data_pagamento pagamento
DEM 2018-02-01 42696.409999999996
DEM 2018-03-01 40288.48
DEM 2018-04-01 42598.5
DEM 2018-05-01 65927.84
DEM 2018-06-01 62985.94
DEM 2018-07-01 63895
DEM 2018-08-01 56419.58
DEM 2018-09-01 67988.98
DEM 2018-10-01 57237.15
@JRobsonJr
JRobsonJr / paramore.csv
Last active September 29, 2019 14:44
Data extracted from Spotify playlist tracks.
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 32 columns, instead of 14. in line 2.
playlist_id,playlist_name,danceability,energy,key,loudness,mode,speechiness,acousticness,instrumentalness,liveness,valence,tempo,track_id,time_signature,track_disc_number,track_duration_ms,track_explicit,track_href,track_is_local,track_name,track_popularity,track_preview_url,track_track_number,track_uri,track_album_id,track_album_name,track_album_release_date,track_album_release_date_precision,key_name,mode_name,key_mode
1VBsfOUrwfoN246Pyjhg33,All Of: Paramore,0.583,0.8290000000000001,8,-8.988999999999999,1,0.0382,5.14e-06,0.852,0.10400000000000001,0.682,121.023,6RaLExL28RxCmQNUnDvUFT,4,1,203773,False,https://api.spotify.com/v1/tracks/6RaLExL28RxCmQNUnDvUFT,False,No Friend,50,https://p.scdn.co/mp3-preview/4cec181bfb5bcb12031f33b0e289b6497d0ed6b1?cid=9ce9f45e428947cd85487ddd20cf9f9b,11,spotify:track:6RaLExL28RxCmQNUnDvUFT,1c9Sx7XdXuMptGyfCB6hHs,After Laughter,2017-05-12,day,G#,major,G# major
1VBsfOUrwfoN246Pyjhg33,All Of: Paramore,0.7340000000000001,0.626,7,-5.685,1,0.0458,0.076,6.54e-06,0.168,0.44,98.559,6t44
@JRobsonJr
JRobsonJr / spotify-data.csv
Last active September 26, 2019 23:20
Data extracted from Spotify playlist tracks.
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 32 columns, instead of 25. in line 2.
playlist_id,playlist_name,danceability,energy,key,loudness,mode,speechiness,acousticness,instrumentalness,liveness,valence,tempo,track_id,time_signature,track_disc_number,track_duration_ms,track_explicit,track_href,track_is_local,track_name,track_popularity,track_preview_url,track_track_number,track_uri,track_album_id,track_album_name,track_album_release_date,track_album_release_date_precision,key_name,mode_name,key_mode
1K28FlYFq6NfwD61GKAXIr,State of Grace / Never Be The Same,0.587,0.823,4,-5.867,1,0.0325,1.89e-4,9.48e-4,0.0899,0.386,129.962,4skZ8JQK5ZT2F5ym6Y05wI,4,1,295720,FALSE,https://api.spotify.com/v1/tracks/4skZ8JQK5ZT2F5ym6Y05wI,FALSE,State Of Grace,2,NA,1,spotify:track:4skZ8JQK5ZT2F5ym6Y05wI,5FerdPFXSHSnCVq4OBy4Ey,Red,2012-10-22,day,E,major,E major
4ZgA4n77UZUqnzcly8siL4,All Of: Taylor Swift,0.587,0.823,4,-5.867,1,0.0325,1.89e-4,9.48e-4,0.0899,0.386,129.962,4skZ8JQK5ZT2F5ym6Y05wI,4,1,295720,FALSE,https://api.spotify.com/v1/tracks/4skZ8JQK5ZT2F5ym6Y05wI,FALSE,State Of Grace,2,NA,1,spotify:track:4skZ
class UnionFind:
def __init__(self, n):
self.parent = [i for i in xrange(n)]
def find(self, elem):
if self.parent[elem] != elem:
self.parent[elem] = self.find(self.parent[elem])
return self.parent[elem]
def union(self, elem1, elem2):
@JRobsonJr
JRobsonJr / Lista7.py
Last active June 6, 2019 00:04
Questões do URI.
# Itinerário do Papai Noel
class UnionFind:
def __init__(self, n):
self.parent = [i for i in xrange(n)]
def find(self, elem):
if self.parent[elem] != elem:
self.parent[elem] = self.find(self.parent[elem])
return self.parent[elem]
'''
Problem
As the football coach at your local school, you have been tasked with picking a team of exactly P students to represent your school. There are N students for you to pick from. The i-th student has a skill rating Si, which is a positive integer indicating how skilled they are.
You have decided that a team is fair if it has exactly P students on it and they all have the same skill rating. That way, everyone plays as a team. Initially, it might not be possible to pick a fair team, so you will give some of the students one-on-one coaching. It takes one hour of coaching to increase the skill rating of any student by 1.
The competition season is starting very soon (in fact, the first match has already started!), so you'd like to find the minimum number of hours of coaching you need to give before you are able to pick a fair team.
Input
The first line of the input gives the number of test cases, T. T test cases follow. Each test case starts with a line containing the two integers N and P, the number o
@JRobsonJr
JRobsonJr / Company.java
Created September 10, 2018 22:49
Refactoring
// ...
private void substractWithDiscount(final Money money, int discount) {
account.substract(Money.newInstance(
money.getAmount() + money.getAmount() * account.overdraftFee() * discount,
money.getCurrency()));
}
@Override
public void withdraw(final Money money) {
if (account.isOverdraft) {