Skip to content

Instantly share code, notes, and snippets.

View rafa-acioly's full-sized avatar
💭
-f

Rafael Acioly rafa-acioly

💭
-f
  • São Paulo - Brazil
View GitHub Profile
@rafa-acioly
rafa-acioly / gist:e9dc4e4a26f0520b868fb0b7a773a916
Created July 26, 2017 22:41 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
create table gravadora(
grav_cod integer,
grav_nome varchar(50) not null,
grav_end varchar(100),
constraint pk_grav primary key (grav_cod)
);
create table cd(
cd_cod integer,
cd_grav_cod integer,
@rafa-acioly
rafa-acioly / create_menu_with_submenu_wordpress.php
Created November 18, 2017 15:48
Organize all menus with their respectives submenus.
<?php
function generateMenu ()
{
$array_menu = wp_get_nav_menu_items('main-menu');
$menu = [];
$submenu = [];
foreach ($array_menu as $item_menu) {
if (empty($item_menu->menu_item_parent)) {
$menu[$item_menu->ID] = [
func main() {
router := mux.NewRouter()
router.HandleFunc("/contato", GetPeople).Methods("GET")
router.HandleFunc("/contato/{id}", GetPerson).Methods("GET")
router.HandleFunc("/contato/{id}", CreatePerson).Methods("POST")
router.HandleFunc("/contato/{id}", DeletePerson).Methods("DELETE")
log.Fatal(http.ListenAndServe(":8000", router))
}
package main
import (
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
)
// nossa função principal
...
func GetPeople(w http.ResponseWriter, r *http.Request) {}
func GetPerson(w http.ResponseWriter, r *http.Request) {}
func CreatePerson(w http.ResponseWriter, r *http.Request) {}
func DeletePerson(w http.ResponseWriter, r *http.Request) {}
...
create table fornecedor(
codigo integer primary key,
razao_social varchar(100),
telefone varchar(10)
);
create table categoria(
codigo integer primary key,
nome varchar(100)
);
@rafa-acioly
rafa-acioly / aula_10.sql
Created April 25, 2018 00:38
functions in sql and plpgsql
create or replace function tipo(varchar)
returns setof notas as
'
SELECT n.* FROM notas n, tiponota t
where t.nome = $1
and t.codigo = n.tipo_nota;
'
language 'sql';
-- select tipo('p1');
@rafa-acioly
rafa-acioly / convert_json_keys_from_camel_case_to_snake_case.py
Last active June 14, 2024 19:42
Convert all keys from json/dict from camelCase to snake_case
"""
This algorith convert all keys from json from camelCase to snake_case recursivily
"""
def _unpack(data):
if isinstance(data, dict):
return data.items()
return data
def snake_case(value):
@rafa-acioly
rafa-acioly / test.go
Created November 6, 2018 15:53
pointer go
// LOOP DE TESTE
for _, tc := range testCases {
t.Run(tc.testName, func(t *testing.T) {
record := Call{
StartPeriod: tc.start,
EndPeriod: tc.end,
}
price, _ := CalcAmount(record)
amountAsDecimal, _ := decimal.NewFromFloat(tc.expectedAmount).Float64()