Skip to content

Instantly share code, notes, and snippets.

View fxcosta's full-sized avatar
:octocat:
Focusing

Felix Costa fxcosta

:octocat:
Focusing
View GitHub Profile
@fxcosta
fxcosta / Laravel-Container.md
Created February 1, 2018 16:33
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

Accessing the Container

canvasName = "mycanvas";
document.getElementById(canvasName).addEventListener('mousemove', function(evt) {
var xy = getMousePos(evt);
var position = (xy.x) + ', ' + (xy.y);
alert(position);
}
@fxcosta
fxcosta / git-upload-st.txt
Created June 6, 2018 16:09
Simples e rápido passo a passo sobre como subir algo para o nosso repositório no gitlab
# Projetos novos
1 - Criar repositório remoto no gitlab: https://gitlab.com/projects/new. Seleciona o usuário da soterotech, escolhe nome do projeto
descrição e clica em criar projeto.
2 - Após criar o repositório remoto, o gitlab dâ um guia para começar o projeto git localmente na máquina. Pode seguir exatamente
o que é proposto por ele.
3 - Se seguir o guia do gitlab, você já terá feito o primeiro commit e já terá feito um primeiro push, então está tudo ok.
# Projetos já no gitlab
1 - Clonar o projeto usando o comando `git clone URL_DO_PROJETO_NO_GITLAB` não esquecendo de usar o endereço HTTPS ao invés do SSH.
2 - O projeto estará na sua máquina bastando commitar e enviar os pushs
@fxcosta
fxcosta / RotateHandler.cs
Created September 28, 2018 12:54
Testing script for rotate a 3d object in Unity3D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GestureHandler : MonoBehaviour {
public float rotationSpeed = 8;
public Camera cam;
<?php
$test = [
[
'role_id' => 1,
'name' => 'criar conteúdo'
],
[
'role_id' => 1,
'name' => 'criar enquete'
@fxcosta
fxcosta / sqlserverstcontains.sql
Created February 18, 2020 20:54
SQL Server query to check if a polygon contains a specific point (coordinates)
DECLARE @g geometry;
DECLARE @h geometry;
SET @g = geometry::STGeomFromText('POLYGON ((-4583852.3559951019 -1744384.5747652152, -4511274.7500624815 -1744384.5747652152, -4511274.7500624815 -1637044.6921474137, -4583852.3559951019 -1637044.6921474137, -4583852.3559951019 -1744384.5747652152))', 4326);
SET @h = geometry::STGeomFromText('POINT (-4546586.20608064 -1672720.54193957)', 4326);
SELECT @g.STContains(@h);
@fxcosta
fxcosta / sqlserverstintersects.sql
Created February 26, 2020 00:02
SQL Server Spatial data Intersects function: check if a specific lat and long is within a coordinate bounds (like from google maps)
DECLARE @boundingRect varchar(1000)
DECLARE @maxLat VARCHAR(20)
DECLARE @minLong VARCHAR(20)
DECLARE @minLat VARCHAR(20)
DECLARE @maxLong VARCHAR(20)
set @maxLat ='-14.862246900491535'
set @minLong ='-40.843608842004876'
set @minLat ='-14.861471748622773'
Ld /Users/sotero/Library/Developer/Xcode/DerivedData/esl-egsmqvltvmiyfocsavspcrbvxrht/Build/Products/Debug-iphonesimulator/RNFBApp/RNFBApp.framework/RNFBApp normal x86_64 (in target 'RNFBApp' from project 'Pods')
cd /Users/sotero/Documents/soterotech/esl-app/ios/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios9.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.1.sdk -L/Users/sotero/Library/Developer/Xcode/DerivedData/esl-egsmqvltvmiyfocsavspcrbvxrht/Build/Products/Debug-iphonesimulator/RNFBApp -F/Users/sotero/Library/Developer/Xcode/DerivedData/esl-egsmqvltvmiyfocsavspcrbvxrht/Build/Products/Debug-iphonesimulator/RNFBApp -F/Users/sotero/Library/Developer/Xcode/DerivedData/esl-egsmqvltvmiyfocsavspcrbvxrht/Build/Products/Debug-iphonesimulator/DoubleConversion -F/Users/sotero/Library/Developer/Xcode/DerivedData/esl-egsmqvltvmiyfocsavspcrbvxrh
@fxcosta
fxcosta / deploy.php
Created April 24, 2020 22:44 — forked from ab-budaev/deploy.php
Deployer config for laravel project
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Configuration
set('ssh_type', 'native');
set('ssh_multiplexing', true);
set('git_tty', true); // [Optional] Allocate tty for git on first deployment
@fxcosta
fxcosta / launch.json
Created May 10, 2020 21:01
vscode configs for debug asp net core app in macos/linux
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",