Skip to content

Instantly share code, notes, and snippets.

View xiCO2k's full-sized avatar
🚒
I'm the web plumber!

Francisco Madeira xiCO2k

🚒
I'm the web plumber!
View GitHub Profile
### Keybase proof
I hereby claim:
* I am xico2k on github.
* I am xico2k (https://keybase.io/xico2k) on keybase.
* I have a public key ASC9ovRc2jlY0QTt88Qwqec_oVTB-S4Qm4sLy5YkjN9jwgo
To claim this, I am signing this object:
<script setup>
import { reactive, onMounted } from 'vue';
const props = defineProps({
is: String,
icons: Array,
});
const list = reactive({});
@xiCO2k
xiCO2k / AuthTest.php
Created October 14, 2022 12:41
Testing Socialite
<?php
it('redirects to the correct Google sign in url', function () {
$driver = Mockery::mock('Laravel\Socialite\Two\GoogleProvider');
$driver->shouldReceive('redirect')
->andReturn(new RedirectResponse('https://redirect.url'));
Socialite::shouldReceive('driver')->andReturn($driver);
$this->get(route('oauth.redirect', 'google'))
@xiCO2k
xiCO2k / view.blade.php
Created October 13, 2022 17:11
Infinite Image fadeIn fadeOut
<div
class="relative pointer-events-none"
x-data="{ active: 0 }"
x-init="setInterval(() =>
active = ++active > $el.childElementCount - 1 ? 0 : active
, 3000)"
>
@foreach([
'hero-pic1.webp',
'hero-pic2.webp',
<?php
use Illuminate\Foundation\Testing\RefreshDatabase;
use Symfony\Component\Console\Output\BufferedOutput;
use function Termwind\render;
use function Termwind\renderUsing;
uses(RefreshDatabase::class);
test('there are no down migrations', function () {
@xiCO2k
xiCO2k / useWebSockets.tsx
Created April 13, 2022 17:41 — forked from jonasgroendahl/useWebSockets.tsx
useWebSockets()
import {useEffect, useRef, useState} from 'react';
import io from 'socket.io-client';
type Props = {
userId: number;
enabled: boolean;
onConnected?: () => void;
};
type Message = {
@xiCO2k
xiCO2k / i18n.js
Last active November 21, 2021 01:52
Simple Localization Script to sue with vue3 and Laravel
import { reactive } from 'vue';
import axios from 'axios';
const reactiveMessages = reactive({});
const loaded = [];
function setI18nLanguage(locale) {
axios.defaults.headers.common['Accept-Language'] = locale;
document.querySelector('html').setAttribute('lang', locale);
@xiCO2k
xiCO2k / gist:3e633aeb4a0be3091cf6d0729179bbab
Created October 21, 2021 15:12
Telnet command to set Sony A5000 shutter speed to 60
bk.elf w 00030081 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@xiCO2k
xiCO2k / gist:b2c2d980169282b266c1cb44f8fbcd26
Created October 21, 2021 15:12
Telnet command to set Sony A5000 shutter speed to 60
bk.elf w 00030081 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@xiCO2k
xiCO2k / docker-compose.yml
Last active September 25, 2021 22:48
Traefik Docker Example
version: "3.3"
networks:
web:
external: true
services:
traefik:
image: "traefik:v2.5"
container_name: "traefik"