Skip to content

Instantly share code, notes, and snippets.

View nilportugues's full-sized avatar

Nil Portugués Calderó nilportugues

View GitHub Profile
@nilportugues
nilportugues / Events & Delegates in Unity C#
Created February 15, 2023 13:08 — forked from dylanfries/Events & Delegates in Unity C#
Events and Delegates for Unity (C#)
Events & Delegates
------------------
Events and Delegates were something I struggled with when I was first learning how they worked. Once I figured it out it became one of the most useful and powerful techniques for games. Its especially useful for helping to decouple classes while allowing for messaging.
Delegates - Simply a container for a function that can be used as a variable.
Events - Allows you to specify a delegate that gets called when some event in your code is triggered.
Overview
@nilportugues
nilportugues / tailwind-color-vars.js
Created September 5, 2022 13:21 — forked from danecando/tailwind-color-vars.js
A simple plugin that exposes all tailwind colors as css variables on :root
function ({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey];
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`);
@nilportugues
nilportugues / SWITCH GAMES.md
Last active May 2, 2024 19:03
SWITCH GAMES.md

My Nintendo Switch games

  • game completed
  • not completed
  • * in progress
  • will not complete

Physical Games

Action

@nilportugues
nilportugues / examples.md
Created February 19, 2021 19:04 — forked from ErisDS/examples.md
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@nilportugues
nilportugues / revert-a-commit.md
Created October 16, 2020 08:04 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@nilportugues
nilportugues / gist:0dc620c54a2c59a7fee48379efdefd45
Created September 23, 2020 13:57 — forked from pnommensen/gist:707b5519766ba45366dd
Ghost CMS with NGINX for Maximum Performance

Full blog post can be found here: http://pnommensen.com/2014/09/07/high-performance-ghost-configuration-with-nginx/

Ghost is an open source platform for blogging founded by John O'Nolan and Hannah Wolfe. It's a node.js application and therefore works great in conjunction with nginx. This guide will will help you create a high performance nginx virtual host configuration for Ghost.

"Don't use #nodejs for static content" - @trevnorris. If #nginx isn't sitting in front of your node server, you're probably doing it wrong.

— Bryan Hughes (@nebrius) August 30, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

The node.js application runs on a port on your server

This file has been truncated, but you can view the full file.
{"info":{"title":"Denintendo.com API","version":"1.0.0"},"produces":["application/json"],"consumes":["application/json"],"securityDefinitions":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"swagger":"2.0","paths":{"/_healthz":{"get":{"operationId":"healthz","description":"Returns OK if application is up.","tags":["Internal: Health"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Success"}}}},"/_healthz/check":{"get":{"operationId":"healthzCheck","description":"List of the services' status.","tags":["Internal: Health"],"consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Success"}}}},"/age_ratings/autocomplete":{"get":{"operationId":"autocompleteAgeRating","description":"Provides autocomplete for age_rating data.","security":[{"Bearer":[]}],"parameters":[{"in":"query","name":"query","required":true,"description":"The terms the being searched for.","default":"","type":"string"}],"tags":["AgeRati
@nilportugues
nilportugues / index.html
Created November 8, 2019 15:50
Modal Slide Up From Bottom
<!-- TO USE WITH WP NAV MENU:
add 'lab-slide-up' to any nav menu item class
-->
<!-- MODAL CONTENT SAMPLE STARTS HERE -->
<div class="modal fade" id="lab-slide-bottom-popup" data-keyboard="false" data-backdrop="false">
<div class="lab-modal-body" >
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h1>
@nilportugues
nilportugues / setup-kubernetes-ubuntu-16.md
Last active September 23, 2019 08:51 — forked from ruanbekker/setup-kubernetes-ubuntu-16.md
Install a 3 Node Kubernetes Cluster on Ubuntu 16

Run in all servers.

sudo swapoff -a

Master: Dependencies

@nilportugues
nilportugues / DeleteButtonWithConfirmation.js
Created July 29, 2019 16:45 — forked from te-online/DeleteButtonWithConfirmation.js
react-admin delete button with confirmation
/*
Copyright (c) 2018 Ady Levy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.