Skip to content

Instantly share code, notes, and snippets.

View Sirpyerre's full-sized avatar
💭
Próxima estación. Mucho más allá del sol

Pedro Rojas Reyes Sirpyerre

💭
Próxima estación. Mucho más allá del sol
View GitHub Profile
@Sirpyerre
Sirpyerre / unmarshalJson.go
Created November 18, 2022 00:17
Unmarshal Json en GO
package main
import (
"encoding/json"
"fmt"
)
type AdminMenu struct {
Menu struct {
ID string `json:"id"`
@Sirpyerre
Sirpyerre / credit.php
Created November 2, 2022 18:25
PHP ternary operator
<?php
$eligible = true;
$hasCredit = false;
$message = $eligible ?
($hasCredit? 'Can use the credit':'Not enough credit')
: 'Not eligible to buy';
echo $message;
@Sirpyerre
Sirpyerre / credit.go
Created November 2, 2022 18:19
Go if/else
package main
import (
"fmt"
)
func main() {
elegible := true
hasCredit := false
@Sirpyerre
Sirpyerre / app.conf
Created June 24, 2022 20:09
nginx config for mezzio php micro framework
server {
server_name app-dsp.local;
root /var/www/html/app-dsp/public;
location / {
try_files $uri index.php @mezzio;
}
location @mezzio {
rewrite /(.*)$ /index.php?/$1 last;
@Sirpyerre
Sirpyerre / Dockerfile
Created June 23, 2022 21:22
dockerfile php7.3, apache, mezzio and mongodb
FROM php:7.3-apache
## Update package information
RUN apt-get update
## Configure Apache
RUN a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf \
&& mv /var/www/html /var/www/public
<?php
// "internacionalization oso entertainment internacionalization oso entertainment ahho atto a2o a2o" => "i18n oso e11t internacionalization oso entertainment"
// "apa water a aa"
echo summarize("internacionalization oso entertainment");
function summarize(string $input)
{
$words = explode(" ", $input);
@Sirpyerre
Sirpyerre / docker-composer.yml
Created June 11, 2021 03:33
Docker compose, remove mysql
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./docker/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
@Sirpyerre
Sirpyerre / Dockerfile
Last active August 16, 2023 21:33
Dockerfile Laravel SQL SERVER
FROM ubuntu:21.10
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
@Sirpyerre
Sirpyerre / copyImagesToBlog.go
Created December 9, 2020 03:53
Script in Go. This script copy from source file path to new destionation.
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/url"
"os"
"path/filepath"
@Sirpyerre
Sirpyerre / change-radio.markdown
Created November 26, 2019 00:21
change radio