Skip to content

Instantly share code, notes, and snippets.

View EdgarValfogo's full-sized avatar
🎯
Focusing

Edgar Valfogo Santos EdgarValfogo

🎯
Focusing
  • São Paulo - Brazil
View GitHub Profile
@EdgarValfogo
EdgarValfogo / SaveSystem.cs
Created April 13, 2020 03:32
Save system para Unity
using UnityEngine;
using System.IO; // Trabalhar com arquivos
using System.Runtime.Serialization.Formatters.Binary; // Para trabalhar com serializacao para binarios
// Não podemos instanciar a classe
public static class SaveSystem
{
private static string saveFilePath = Application.persistentDataPath + "/data.ps"; // Trabalha com a localização do executável, independente do SO
@EdgarValfogo
EdgarValfogo / DataNamesAttribute.cs
Last active February 28, 2020 19:50
Method that creates a query string to INSERT INTO within the attributes
[AttributeUsage(AttributeTargets.Property)]
public class DataNamesAttribute : Attribute
{
protected List<string> _valueNames { get; set; }
public List<string> ValueNames
{
get
{
return _valueNames;
@EdgarValfogo
EdgarValfogo / ControllerExample.cs
Created September 26, 2019 20:32
Asp.net Core service to read Rendered Razor View as string
public class DocumentsController
{
private readonly IViewRenderService _viewRenderService;
// Dependency Injection is happening here
public DocumentsController(IViewRenderService viewRenderService)
{
_viewRenderService = viewRenderService;
}
@EdgarValfogo
EdgarValfogo / tokenGetter.ts
Created August 21, 2019 21:46
How to add tokenGetter to appModule. Problem solver: "Cannot read property 'tokenGetter' of undefined at new JwtInterceptor"
// Create a function that get the token from some storage
export function tokenGetter() {
console.log('token');
return localStorage.getItem('token');
}
@NgModule({
declarations: [
AppComponent,
],
@EdgarValfogo
EdgarValfogo / animais.json
Last active June 3, 2019 19:26 — forked from borlaym/animals.json
Array de animais - Tradução para Português - WIP
[
"Porco Da Terra",
"Albatross",
"Alligator",
"Alpaca",
"Ant",
"Anteater",
"Antelope",
"Ape",
"Armadillo",
@EdgarValfogo
EdgarValfogo / web.config
Created May 30, 2019 16:56
Web config for angular deployment on IIS
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
@EdgarValfogo
EdgarValfogo / comparearrays.js
Created May 28, 2019 17:07
Compare two arrays by its attributes
let arrA = [
{
nome: 'josias',
idade: 24
},
{
nome: 'paulo',
idade: 25
}
];