Skip to content

Instantly share code, notes, and snippets.

View skatesham's full-sized avatar
🏠
Working from home

Sham skatesham

🏠
Working from home
View GitHub Profile
@lorisleiva
lorisleiva / AppWithLocalStorage.vue
Last active June 27, 2023 20:27
Abstraction of the local storage using Vue3's composition API
<script setup>
import useLocalStorage from './useLocalStorage'
const publicKey = useLocalStorage('solana-wallet-public-key')
</script>
<template>
<div>
<input type="text" v-model="publicKey">
<div v-text="publicKey"></div>
</div>
@skatesham
skatesham / bobble_sort.py
Last active October 7, 2020 23:25
Simples bobble_sort Sort Algorithm
import unittest
def bobble_sort(values):
"""
Sorting list algorithm type of BobbleSort.
Time O(n**2 - n)
Space O(n + 3)
:author sham vinicius fiorin
:param values: List of comparable objects
class Mapper:
def convertValue(self, data, obj):
"""
Mapper from dict to class, covering it's chieldrens but the key on dict must be mapping the chield with .
Exemple: data = {
"x": 0,
"y": 1,
"chield.a": "Sham Vinicius",
"chield.b": "Fiorin",
"chield.layer.c": "xxx",
@gaearon
gaearon / index.html
Last active January 26, 2024 11:25
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@amiyasahu
amiyasahu / GetterSetterVerifier.java
Created June 7, 2018 20:17 — forked from mjpitz/GetterSetterVerifier.java
A class that uses reflection to automate the testing of getters and setters.
import com.google.common.base.Defaults;
import com.google.common.collect.Sets;
import javax.annotation.Nonnull;
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Set;
@jesuino
jesuino / PlotarFuncao.java
Created March 6, 2018 22:08
Utilidade para plotar funções matemáticas com JavaFX
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.DoubleFunction;
import javafx.application.Application;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.chart.CategoryAxis;
@codediodeio
codediodeio / index.js
Created June 28, 2017 15:54
Firebase Cloud Functions image thumbnail generator using Sharp for 4x faster resizing
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const sharp = require('sharp')
const _ = require('lodash');
const path = require('path');
const os = require('os');
exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => {
const object = event.data; // The Storage object.
@fmasanori
fmasanori / Oficina MongoDB e Python FISL
Last active August 22, 2022 11:07
Oficina MongoDB e Python FISL
Oficina MongoDB e Python - FISL
Resumo https://university.mongodb.com/courses/M220P/about
Install python 3.x (provavelmente vc já tem, 3.7 no mínimo)
https://www.python.org/downloads/
para testar python -V
Install mongoDB última versão (mínimo 4.x)
https://www.mongodb.org/downloads
criar diretório \data\db com as permissões necessárias para testar bin\mongod (servidor)
@fmasanori
fmasanori / CRUD Excepion.py
Last active February 12, 2019 13:42
CRUD MongoDB exception
import pymongo
import sys
def main():
connection = pymongo.MongoClient("mongodb://localhost")
db = connection.m101
people = db.people
person = {'name': 'Barack Obama', 'role':'President',
'address':{'address1':'The White House',
'street': '1600 Pensylvania Avenue',
@fmasanori
fmasanori / CRUD MongoDB.py
Last active September 1, 2020 14:29
CRUD MongoDB Python2
from datetime import datetime
from pymongo import MongoClient
connection = MongoClient("mongodb://localhost")
db = connection.test
post = {"title": "My Blog Post",
"content": "Here's my blog post.",
"date": datetime.utcnow()}