Skip to content

Instantly share code, notes, and snippets.

View icavalheiro's full-sized avatar
😅

Ivan Schuaste Cavalheiro icavalheiro

😅
View GitHub Profile
@icavalheiro
icavalheiro / squidex-service.js
Created August 17, 2020 16:49
an example read-only service for squidex
const CONFIG = {
url: 'https://cloud.squidex.io',
appName: 'sample-blog',
clientId: 'sample-blog:blog',
clientSecret: 'ZxmQGgouOUmyVU4fh38QOCqKja3IH1vPu1dUx40KDec='
};
function getBearerToken() {
return localStorage.getItem('token');
}
@icavalheiro
icavalheiro / .ps1_color
Created August 14, 2020 01:22 — forked from afeijo/.ps1_color
My colored linux prompt
# download me or copy & paste into your root folder, name it .ps1_color
# add the line below into your ~/.profile or ~/.bashrc
# source ~/.ps1_color
# ANSI color codes
RS="\[\033[0m\]" # reset
HC="\[\033[0;1m\]" # hicolor
UL="\[\033[4m\]" # underline
INV="\[\033[7m\]" # inverse background and foreground
FBLK="\[\033[30m\]" # foreground black
@icavalheiro
icavalheiro / alias.cmd
Created August 3, 2020 23:13
alias for cmder
edit_alias=code "D:\cmder\config\user_aliases.cmd"
gs=git status
@icavalheiro
icavalheiro / settings.json
Created August 3, 2020 23:12
vs code settings
{
"workbench.iconTheme": "vscode-icons",
"editor.minimap.enabled": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"html.format.endWithNewline": true,
"html.format.indentHandlebars": true,
"javascript.format.insertSpaceAfterConstructor": true,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true,
@icavalheiro
icavalheiro / settings.json
Created August 3, 2020 23:08
windows terminal - settings
// This file was initially generated by Windows Terminal 1.1.2021.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{a9d75fd5-c48a-43d9-8516-2ea5c2f4b913}",
// You can add more global application settings here.

Criar o arquivo de serviço

Crie o arquivo de definição de serviço:

$ sudo nano /etc/systemd/system/kestrel-helloapp.service

A seguir, um exemplo de arquivo de serviço para o aplicativo:

@icavalheiro
icavalheiro / WorldToViewport.js
Created June 7, 2020 14:51
Snipped to convert a Mesh position to the viewport position in Babylonjs
const mesh: Mesh // the mesh I want to know the size and position of
const worldMatrix = mesh.getWorldMatrix()
const transformMatrix = scene.getTransformMatrix()
const position = mesh.position
const viewport = scene.activeCamera!.viewport
const coordinates = Vector3.Project(position, worldMatrix, transformMatrix, viewport)
@icavalheiro
icavalheiro / Program.cs
Created May 24, 2020 15:41
Program.cs example for ASP.NET core 3 that includes database seeding
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CampaignPortal.Database;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@icavalheiro
icavalheiro / EmailService.cs
Created May 14, 2020 21:28
Email service for donet (and Umbraco) using mailkit
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
using MimeKit.Text;
using System.Collections.Generic;
namespace Logic.Services
{
public class EmailService
{
@icavalheiro
icavalheiro / Composer.cs
Created May 14, 2020 21:25
Umbraco Base Composer class
using Logic.Services;
using Umbraco.Core.Composing;
using Umbraco.Web;
using Umbraco.Web.Dashboards;
using Umbraco.Web.Sections;
namespace PROJECT
{
public class Composer : IUserComposer
{