Skip to content

Instantly share code, notes, and snippets.

View juanwilde's full-sized avatar

Juan González juanwilde

  • Metro Markets GmbH
  • Palma de Mallorca
View GitHub Profile
server {
listen 443 ssl;
server_name api.server.com;
ssl_certificate /etc/ssl/cloudflare/api.pem;
ssl_certificate_key /etc/ssl/cloudflare/key.key;
client_max_body_size 20M;
location / {
// Coupled to framework (a service knowing about the implementation of the data layer)
class OrderService
{
public function getOrders(): iterable
{
return Order::all();
}
}
// Not coupled to framework
[supervisord]
user=root
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/var/run/supervisord.pid
loglevel = INFO
[unix_http_server]
file=/var/run/supervisor.sock
name: Tests
on:
pull_request:
branches: [ main ]
jobs:
build:
name: Run tests
runs-on: ubuntu-latest
public function __invoke(User $user): void
{
if (!$user instanceof UserInterface) {
return;
}
// some great stuff here
}
{
// 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": [
{
"type": "node",
"request": "launch",
"name": "Debug Nest Framework",
@juanwilde
juanwilde / .htaccess
Created August 31, 2016 12:38
htaccess Codeigniter 3
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
@juanwilde
juanwilde / show.php
Created August 23, 2016 06:44
Ejemplo para mostrar imagen obtenida mediante scraping con simple_html_dom.php
<?php
foreach ($imgPaths as $img) {
echo '<img src="' . $img->attr["src"] . '"'/>
}
@juanwilde
juanwilde / factory.js
Last active May 7, 2016 13:33
Ejemplo de envío
// factory.js
.factory('Nombre', ['$resource', function ($resource) {
return $resource('http://url.api/api/login', {}, {
save: {
method: 'POST',
headers: {Authentication: 'tu_token_o_apikey'}
}
});
}]);
@juanwilde
juanwilde / suscriptions.php
Last active April 11, 2016 01:09
Part of suscriptions.php
/**
* @param $msisdn
* @param $amount
* @param $token
* @return array
*/
public function getBill($msisdn, $amount, $token)
{
if($this->_billError500 == true) {
error_log(print_r('ha dado error 500', true));