Skip to content

Instantly share code, notes, and snippets.

View PabloAlexandre's full-sized avatar

Pablo Salgado PabloAlexandre

View GitHub Profile
@PabloAlexandre
PabloAlexandre / uv-utils.ts
Last active April 29, 2023 02:53
Function to get UV points from 3D coordinate in cubemap images
export interface Vector3 {
x: number;
y: number;
z: number;
}
export function get3DPointFromSphere(phi: number, theta: number) {
const coordinates = {x: 0, y: 0, z: 0};
coordinates.x = Math.sin(theta) * Math.cos(phi);
const Scene = () => {
const texture = useTexture(image);
const camera = useThree(({ camera }) => camera);
return (
<>
<OrbitControls
camera={camera}
minZoom={1}
maxZoom={1}
import { Canvas } from '@react-three/fiber';
import { useTexture } from '@react-three/drei';
import { DoubleSide, Vector3 } from 'three';
import image from './panorama.jpg';
import { Suspense } from 'react';
const Scene = () => {
const texture = useTexture(image);
import { Canvas } from '@react-three/fiber';
function App() {
return (
<div style={{ width: '100vW', height: '100vH', background: '#723983' }}>
<Canvas camera={{
near: 1,
far: 1100,
aspect: 16 / 9,
fov: 70
$app->register(App\Providers\RollbarServiceProvider::class);
$app->configure('logging');
<?php
namespace App\Providers;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Support\ServiceProvider;
use Rollbar\RollbarLogger;
use Rollbar\Rollbar;
use Monolog\Handler\RollbarHandler;
use Monolog\Logger;
<?php
return [
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['rollbar'],
],
'rollbar' => [
@PabloAlexandre
PabloAlexandre / color-utils.js
Last active November 17, 2020 14:35
Color Generator from String
export const createColorFromName = (name, saturation = 30, lightness = 60) => {
if (name.length === 0) return hash;
const nameHash = name.split('').reduce((hash, letter, i) => {
hash = name.charCodeAt(i) + ((hash << 5) - hash)
return hash & hash
}, 0);
return `hsl(${nameHash % 360}, ${saturation}%, ${lightness}%)`;
@PabloAlexandre
PabloAlexandre / techlist.md
Last active October 25, 2019 18:09
Recomendações gerais de artigos sobre tecnologia
export function promisifyAll(classToPromisify) {
const props = Object.getOwnPropertyNames(Object.getPrototypeOf(classToPromisify));
const fns = props.sort().filter((e, i, arr) => {
return e !== arr[i + 1] && e !== 'constructor' && typeof classToPromisify[e] === 'function';
});
fns.forEach((e) => {
classToPromisify[`${e}Async`] = (...args) => new Promise((resolve, reject) => {
return classToPromisify[e].call(classToPromisify, ...args, (err, data) => {