Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
What’s up?

Ademílson F. Tonato ftonato

🦄
What’s up?
View GitHub Profile
@ftonato
ftonato / Supabase.service.js
Created Feb 7, 2021
SupabaseService using Singleton pattern
View Supabase.service.js
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 Jan 12, 2021
alpinejs-html-structure
View alpinejs-html-structure.html
<!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 Mar 7, 2020
./clearcache.sh < 1 | 2 | 3 >
View clearcache.sh
#!/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
View basic-flexbox.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic Flexbox</title>
<style>
* {
margin: 0;
padding: 0;
View basic-media-query.html
<!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 May 7, 2020
PDO Connection Class using Singleton
View database.class.php
<?php
/**
* PDO Singleton Class v.1.0
*
* @author Ademílson F. Tonato
* @link https://twitter.com/ftonato
*
*/
class DB {
@ftonato
ftonato / CONTRIBUTING.md
Created Sep 6, 2016
GitHub CONTRIBUTING.md template
View CONTRIBUTING.md

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 Jul 27, 2016
SQL to search database object's definitions
View search_database_objects_definitions.sql
-- 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 + '%'