This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeDate = (year: number, month: number, day: number) => | |
new Date(year, month, day, 0, 0, 0) | |
const makeRangeBetweenDates = (start: Date, end: Date) => { | |
const range: Date[] = [] | |
for ( | |
const i = new Date(start); | |
i.getTime() <= end.getTime(); | |
i.setDate(i.getDate() + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
class CSVBuilder | |
def initialize | |
@columns = [] | |
@data = [] | |
end | |
def add_column(column_name) | |
@columns << column_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ElapsedTime | |
def elapsed | |
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
yield if block_given? | |
end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) | |
elapsed_time = "%.2f" % (end_time - start_time) | |
puts "Tempo decorrido: #{elapsed_time} segundos" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:3.2.2-alpine | |
LABEL maintainer="Lucivaldo Castro <lucivaldocb@gmail.com>" | |
RUN apk update && apk add --virtual build-dependencies build-base | |
RUN apk add \ | |
less \ | |
mailcap \ | |
sqlite-dev \ | |
tzdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def text_to_fuzzy_search(text) | |
first_word, *rest_words = text.split | |
rest_words_chars = rest_words.map { _1.split('') } | |
search = first_word.dup | |
array = [search] | |
rest_words_chars.each do |chars| | |
search += " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { faCheck, faTimes, faWarning } from '@fortawesome/free-solid-svg-icons'; | |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | |
import { | |
Box, | |
Button, | |
Dialog, | |
DialogActions, | |
DialogContent, | |
DialogTitle, | |
Backdrop, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAllResources = async (resources, params) => { | |
const asyncIterable = { | |
[Symbol.asyncIterator]() { | |
return { | |
page: '1', | |
finished: false, | |
async next() { | |
if (!this.finished) { | |
const response = await api.get(resources, { | |
params: { ...params, page: this.page }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Android Studio | |
#set -x ANDROID_STUDIO_HOME $HOME/android-studio | |
#set PATH $ANDROID_STUDIO_HOME/bin $PATH | |
# Configurações para Cordova | |
set -x ANDROID_SDK_ROOT $HOME/Android/Sdk | |
set -x ANDROID_HOME $HOME/Android/Sdk | |
set PATH $HOME/.sdkman/candidates/gradle/6.6.1/bin $PATH | |
# Configurações para Ionic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var name = 'Lucivaldo Castro Castelo Branco'; | |
print(twoLetters(name)); | |
} | |
String twoLetters(String name) { | |
if (name.trim().isEmpty) return null; | |
var nameSplited = name.trim().replaceAll(RegExp(r'\s+', ), ' ').split(' '); | |
var letters = nameSplited.first[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
module ChangeWallpaper | |
HOME = ENV['HOME'] | |
PICTURES_PATH = HOME + '/Pictures' | |
WALLPAPERS_PATH = PICTURES_PATH + '/Wallpapers' | |
def self.change | |
wallpaper = Dir.glob("#{WALLPAPERS_PATH}/**/*").sample | |
command = "gsettings set org.gnome.desktop.background picture-uri #{wallpaper}" |
NewerOlder