Skip to content

Instantly share code, notes, and snippets.

View xcesaralejandro's full-sized avatar
😎
Amistad es amigo

César Alejandro Mora Cid xcesaralejandro

😎
Amistad es amigo
View GitHub Profile
@matiaslopezd
matiaslopezd / instrucciones.md
Last active February 14, 2020 03:16
How to use Woocommerce Rest API v3 - Not legacy! | Como usar Rest API de Woocommerce v3 - No heredada

Autorización

Para usar la Rest API es necesario proveer de consumer_key y consumer_secret en la URL como parámetros. (Nunca pude pasarlo en la cabecera)

Ejemplo:

https://mywebsite.com/wp-json/wc/v3/products?consumer_key=XXXX&consumer_secret=XXXX
@pyrou
pyrou / docker-compose.yml
Last active April 18, 2024 05:20
Use https://traefik.me SSL certificates for local HTTPS without having to touch your /etc/hosts or your certificate CA.
version: '3'
services:
traefik:
restart: unless-stopped
image: traefik:v2.0.2
ports:
- "80:80"
- "443:443"
labels:
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
@matiaslopezd
matiaslopezd / dni_cl_validator.js
Last active February 27, 2021 18:33
Chilean DNI validator and get in JSON { run: Number/String, adv: Number/String, dv: Number/String, valid: Boolean }
function DNI_CL({ run, string }){
if(run !== '' && (typeof run === "string" || typeof run === "number")){
function format(n){
if (typeof n === 'string') {
// Remove '.' if exist
n = (n.includes('.')) ? n.split('.').join('') : n;
// Remove '-' if exist
n = (n.includes('-')) ? n.split('-').join('') : n;
@GhostofGoes
GhostofGoes / .gitignore
Created October 4, 2018 04:29
Basic .gitignore template for Python projects
# Editors
.vscode/
.idea/
# Vagrant
.vagrant/
# Mac/OSX
.DS_Store
@rohankhudedev
rohankhudedev / opcache.ini
Last active April 19, 2024 09:56
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@jbasdf
jbasdf / canvas_lti_variables
Created November 11, 2017 00:49
All Canvas LTI Variables for substitution
context_title: "$Context.title",
com_instructure_post_message_token: "$com.instructure.PostMessageToken",
com_instructure_assignment_lti_id: "$com.instructure.Assignment.lti.id",
com_instructure_originality_report_id: "$com.instructure.OriginalityReport.id",
com_instructure_submission_id: "$com.instructure.Submission.id",
com_instructure_file_id: "$com.instructure.File.id",
course_offering_sourced_id: "$CourseOffering.sourcedId",
context_id: "$Context.id",
context_sourced_id: "$Context.sourcedId",
message_document_target: "$Message.documentTarget",
@odan
odan / xmapp-replacing-mariadb-with-mysql.md
Last active June 4, 2023 19:44
XAMPP - Replacing MariaDB with MySQL

XAMPP - Replacing MariaDB with MySQL

This post has been deleted.

@juanbrujo
juanbrujo / comunas-regiones.json
Last active April 19, 2024 21:12 — forked from sergiohidalgo/comunas-regiones-chile.json
Comunas y regiones de chile JSON
{
"regiones": [
{
"region": "Arica y Parinacota",
"comunas": ["Arica", "Camarones", "Putre", "General Lagos"]
},
{
"region": "Tarapacá",
"comunas": ["Iquique", "Alto Hospicio", "Pozo Almonte", "Camiña", "Colchane", "Huara", "Pica"]
},
@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin
@yajra
yajra / axios-401-response-interceptor.js
Last active September 20, 2023 06:24
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,