Skip to content

Instantly share code, notes, and snippets.

View ftonato's full-sized avatar
🦄
What’s up?

Ademílson F. Tonato ftonato

🦄
What’s up?
View GitHub Profile
@ftonato
ftonato / Supabase.service.js
Created February 7, 2021 15:25
SupabaseService using Singleton pattern
import { createClient } from '@supabase/supabase-js'
let instance = null
export default class SupabaseService {
constructor(supabaseUrl = process.env.SUPABASE_URL, supabaseKey = process.env.SUPABASE_SECRET_KEY) {
if (!supabaseUrl) throw new Error(`${SupabaseService.getClassName()} => supabaseUrl is required.`)
if (!supabaseKey) throw new Error(`${SupabaseService.getClassName()} => supabaseKey is required.`)
@ftonato
ftonato / alpinejs-html-structure.html
Last active January 12, 2021 14:12
alpinejs-html-structure
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Alpinejs + TailwindCSS • Todo List</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://unpkg.com/tailwindcss@0.3.0/dist/tailwind.min.css"
rel="stylesheet"
@ftonato
ftonato / clearcache.sh
Last active March 7, 2020 12:42
./clearcache.sh < 1 | 2 | 3 >
#!/bin/bash
# Note, we are using "echo 3", but it is not recommended in production instead use "echo 1"
LEVEL=${1:-1} # If variable not set or null, use "1".
shift $(( $# > 0 ? 1 : 0 ))
# Check LEVEL is invalid then set to default "1"
if [ "$LEVEL" -gt 3 ]; then
LEVEL=1
fi
@ftonato
ftonato / basic-flexbox.html
Created December 12, 2016 11:42
Basic Flexbox
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic Flexbox</title>
<style>
* {
margin: 0;
padding: 0;
@ftonato
ftonato / basic-media-query.html
Created December 12, 2016 11:41
Basic Media Query
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic Media Query</title>
<style>
.title {
color: #222;
@ftonato
ftonato / database.class.php
Last active March 3, 2024 04:30
PDO Connection Class using Singleton
<?php
/**
* PDO Singleton Class v.1.0
*
* @author Ademílson F. Tonato
* @link https://twitter.com/ftonato
*
*/
class DB {
@ftonato
ftonato / CONTRIBUTING.md
Created September 6, 2016 14:19
GitHub CONTRIBUTING.md template

Contributing guide

Want to contribute to PROJECT NAME? Awesome! There are many ways you can contribute, see below.

Opening issues

Open an issue to report bugs or to propose new features.

Proposing pull requests

Pull requests are very welcome. Note that if you are going to propose drastic changes, be sure to open an issue for discussion first, to make sure that your PR will be accepted before you spend effort coding it.

@ftonato
ftonato / search_database_objects_definitions.sql
Last active July 27, 2016 14:18
SQL to search database object's definitions
-- find objects which contain 'Pilots' in defintion
DECLARE @search VARCHAR(255)
SET @search='Pilots'
SELECT DISTINCT o.NAME AS Object_Name
, o.type_desc
FROM sys.sql_modules m
INNER JOIN sys.objects o
ON m.object_id = o.object_id
WHERE m.definition LIKE '%' + @search + '%'