Skip to content

Instantly share code, notes, and snippets.

View pjbelo's full-sized avatar

Paulo Belo pjbelo

View GitHub Profile
@pjbelo
pjbelo / weekday_name2.dart
Created August 22, 2022 15:39
print weekday name (v2) [dart]
extension DateTimeExtension on DateTime {
String? weekdayName() {
const Map<int, String> weekdayName = {1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", 5: "Friday", 6: "Saturday", 7: "Sunday"};
return weekdayName[weekday];
}
}
void main() {
print(DateTime.now().weekdayName());
}
@pjbelo
pjbelo / weekday_name1.dart
Created August 22, 2022 15:38
print weekday name (v1) [dart]
const Map<int, String> weekdayName = {1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", 5: "Friday", 6: "Saturday", 7: "Sunday"};
void main() {
print(weekdayName[DateTime.now().weekday]);
}
@pjbelo
pjbelo / ElementTree_XML_in_Python.ipynb
Last active June 15, 2022 14:22
QuickStart to ElementTree: Manipulating XML in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pjbelo
pjbelo / top10movies.xml
Created June 10, 2022 13:30
IMDB Top 10 Movies XML
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<movie>
<id>0111161</id>
<rank>1</rank>
<title>The Shawshank Redemption</title>
<fullTitle>The Shawshank Redemption (1994)</fullTitle>
<year>1994</year>
<image>https://m.media-amazon.com/images/M/MV5BMDFkYTc0MGEtZmNhMC00ZDIzLWFmNTEtODM1ZmRlYWMwMWFmXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_UX128_CR0,3,128,176_AL_.jpg</image>
<crew>Frank Darabont (dir.), Tim Robbins, Morgan Freeman</crew>
@pjbelo
pjbelo / top250movies.xml
Last active June 10, 2022 13:25
IMDB Top 250 Movies XML
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<movie>
<id>0111161</id>
<rank>1</rank>
<title>The Shawshank Redemption</title>
<fullTitle>The Shawshank Redemption (1994)</fullTitle>
<year>1994</year>
<image>https://m.media-amazon.com/images/M/MV5BMDFkYTc0MGEtZmNhMC00ZDIzLWFmNTEtODM1ZmRlYWMwMWFmXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_UX128_CR0,3,128,176_AL_.jpg</image>
<crew>Frank Darabont (dir.), Tim Robbins, Morgan Freeman</crew>

create a new repository on the command line

echo "# myproject" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:pjbelo/myproject.git
git push -u origin main

push an existing repository from the command line

@pjbelo
pjbelo / main.dart
Created January 20, 2022 16:31
Hello Flutter World
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
@pjbelo
pjbelo / add_bootstrap_rails6.md
Last active June 10, 2021 09:23
Add Bootstrap to Rails 6

Add Bootstrap 4 to Rails 6

run in terminal (project dir):

yarn add [email protected] jquery popper.js

file: app/assets/stylesheets/application.css

rename to:

@pjbelo
pjbelo / launch.json
Last active May 1, 2021 11:05
VS Code - Ruby configuration - Debug local file - the current opened file
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${file}"
}
@pjbelo
pjbelo / index.html
Created August 24, 2020 16:39
HTML reading Three.js project
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>my3DProject</title>
</head>
<body>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js">
</script>