Skip to content

Instantly share code, notes, and snippets.

View omirobarcelo's full-sized avatar

Oriol Miro Barcelo omirobarcelo

View GitHub Profile
@omirobarcelo
omirobarcelo / main.ts
Created December 9, 2024 19:16
ngx-countdown Remaining days
import 'zone.js';
import { bootstrapApplication } from '@angular/platform-browser';
import { Component } from '@angular/core';
import { CountdownComponent, CountdownConfig } from 'ngx-countdown';
@Component({
selector: 'my-app',
template: `
<countdown [config]="config"></countdown>
@omirobarcelo
omirobarcelo / docker-compose.yml
Created September 20, 2024 06:25
Minimal Puppeteer Docker Compose
services:
minimal:
platform: linux/amd64
build:
context: .
dockerfile: Dockerfile.minimal
environment:
- NODE_ENV=LOCAL
- DOCKER=true
- SERVICE=RENTALCARS
@omirobarcelo
omirobarcelo / Dockerfile.minimal
Created September 20, 2024 06:23
Minimal Puppeteer Dockerfile
# Base image
FROM debian:bullseye-slim
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Setup the base OS
RUN apt-get update -qq \
@omirobarcelo
omirobarcelo / index.js
Created September 20, 2024 06:22
Minimal Puppeteer Node.js code
const puppeteer = require('puppeteer-extra');
const RecaptchaPlugin = require('puppeteer-extra-plugin-recaptcha');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
const { consola } = require('consola');
const fs = require('fs');
const { delay } = require('../utils/async');
const DOCKER = process.env['DOCKER'];
const SERVICE = process.env['SERVICE'];
@omirobarcelo
omirobarcelo / create.pcss
Created April 17, 2021 10:57
WebHero - 6 - Create responsive styling
.create-container {
@apply px-2 py-2 flex flex-col items-center;
}
form {
@apply w-full pt-6 pb-8 mb-4;
max-width: 768px;
}
.img-title-area {
@omirobarcelo
omirobarcelo / Contact.pcss
Created April 17, 2021 10:55
WebHero - 6 - Contact responsive styling
.contact-container {
@apply px-2 py-2 flex flex-col items-center;
}
@screen sm {
.contact-container {
@apply px-4 py-6;
}
}
@omirobarcelo
omirobarcelo / layout.pcss
Created April 17, 2021 10:48
WebHero - 6 - Layout responsive styling
.main-content {
@apply flex flex-col;
}
.ads {
@apply flex-auto;
min-width: 120px;
min-height: 100px;
max-width: 100%;
max-height: 100px;
@omirobarcelo
omirobarcelo / Nav.pcss
Created April 17, 2021 10:45
WebHero - 6 - Navbar responsive styling
nav {
@apply w-full flex items-center justify-between flex-wrap bg-orange-600 p-4;
}
.logo-container {
@apply flex items-center flex-shrink-0 text-white mr-6;
order: 0;
}
input[type="search"] {
@omirobarcelo
omirobarcelo / Nav.svelte
Created April 17, 2021 10:22
WebHero - 6 - Disable and navigation of search bar
<script lang="ts">
export let segment: string;
$: if (segment === 'create') {
search.update('');
// If navigating directly to create, this executes before the onMount
if (searchElem) {
searchElem.value = '';
}
}
@omirobarcelo
omirobarcelo / use-alert.svelte
Created April 11, 2021 17:02
WebHero - 5 - Using the alert
{#if serverRes}
{#if serverRes.successful}
<Alert type="success" message="Your game has been successfully saved and it's awaiting review!" />
{:else}
<Alert
type="error"
message={serverRes.errorMsg ? serverRes.errorMsg : 'There was a problem sending your game entry. Please, try again.'}
/>
{/if}
{/if}