Skip to content

Instantly share code, notes, and snippets.

Avatar

Thiago Filadelfo trfiladelfo

View GitHub Profile
@trfiladelfo
trfiladelfo / Code.gs
Created Jun 3, 2021 — forked from superstrong/Code.gs
Google Script to generate a UUID in Google Sheets
View Code.gs
function getId() {
/**
* Imported from https://github.com/kyo-ago/UUID
* Robbie Mitchell, @superstrong
*/
/**
* UUID.core.js: The minimal subset of the RFC-compliant UUID generator UUID.js.
*
* @fileOverview
@trfiladelfo
trfiladelfo / index.html
Created Jul 30, 2020
Microsoft Homepage Clone
View index.html
<div class="menu-btn">
<i class="fas fa-bars fa-2x"></i>
</div>
<div class="container">
<!-- Nav -->
<nav class="main-nav">
<img src="https://i.ibb.co/wwLhz98/logo.png" alt="Microsoft" class="logo">
<ul class="main-menu">
@trfiladelfo
trfiladelfo / dependencies.txt
Created Jul 6, 2020
utilizando datas e timezone em javascript
View dependencies.txt
moment.min.js
moment-timezone-with-data-2010-2020.min.js
@trfiladelfo
trfiladelfo / main.py
Created May 5, 2020
interval in two dates
View main.py
from datetime import timedelta, date
def daterange(date1, date2):
for n in range(int ((date2 - date1).days)+1):
yield date1 + timedelta(n)
start_dt = date(2015, 12, 20)
end_dt = date(2016, 1, 11)
for dt in daterange(start_dt, end_dt):
print(dt.strftime("%Y-%m-%d"))
@trfiladelfo
trfiladelfo / mongodb_model.py
Created Apr 29, 2020 — forked from fatiherikli/mongodb_model.py
Very simple MongoDB Model in Python
View mongodb_model.py
from pymongo import Connection
from bson import ObjectId
from itertools import imap
class Model(dict):
"""
A simple model that wraps mongodb document
"""
__getattr__ = dict.get
@trfiladelfo
trfiladelfo / export-to-csv.gs
Created Apr 26, 2020 — forked from franklinbaldo/export-to-csv.gs
Google apps script to export to individual csv files all sheets in an open spreadsheet
View export-to-csv.gs
function myFunction() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName("orange");
var range = sheet.getRange("1:1").getValues();
var titles = range[0];
var a1range = "A1:A";
var a1array = [];
a1range = a1range +titles.length*titles.length;
var b1range = "B1:B";
@trfiladelfo
trfiladelfo / Coce.gs
Created Apr 26, 2020 — forked from dommmel/Coce.gs
Google Apps Script to upload and import a CSV File into a Google Spreadsheet
View Coce.gs
// http://stackoverflow.com/questions/11273268/script-import-local-csv-in-google-spreadsheet
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "Upload CSV file", functionName: "doGet"}];
ss.addMenu("CSV", csvMenuEntries);
}
function doGet(e) {
var app = UiApp.createApplication().setTitle("Upload CSV to Sheet");
@trfiladelfo
trfiladelfo / upload.ipynb
Created Apr 25, 2020
upload file in jupyter notebook
View upload.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trfiladelfo
trfiladelfo / convert.kt
Last active Apr 16, 2020
Exemplo de conversão de JSON para classe
View convert.kt
import org.json.JSONObject
import org.json.JSONArray
class Task(val title:String, val email:String, val description:String) {
fun convertToJSON(): JSONObject {
val json = JSONObject()
json.put("title", title)
json.put("email", email)
json.put("description", description)
return json
View Android DeviceUtils.kt
/**
* immersiveMode
* set onPostResume, onSystemUiVisibilityChange
*/
fun immersiveMode(activity: Activity) {
activity.window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
activity.window
.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {