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
@MichaelCurrie
MichaelCurrie / python_multiprocessing_example.py
Last active May 23, 2020 02:49
Python multiprocessing example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A basic example using multiple processes
We spawn 4 processes. Each process is made to draw N/4 random
integers from 1 to 10, for some fixed large N.
Then the processes adds up its list of numbers, passes it into a queue,
and the main program adds up the subtotals to get a grand total.
@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;
@mcasperson
mcasperson / gist:5588341
Created May 15, 2013 23:43
Installing Supervisord 3 in RHEL
yum install python-setuptools
Follow install instructions at http://supervisord.org/installing.html
Create /etc/init.d/supervisord
#!/bin/bash
#
# supervisord This scripts turns supervisord on
#
@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",
@drewjoh
drewjoh / Cors.php
Created June 13, 2016 22:47
Laravel CORS Middleware
<?php // /app/Http/Middleware/Cors.php
namespace App\Http\Middleware;
use Closure;
class Cors {
public function handle($request, Closure $next)
{
return $next($request)
@Dammmien
Dammmien / mustache.md
Last active April 27, 2023 22:41
Mustache cheatsheet

Basic tag

  Hello {{name}} !!

Comments

 {{! This is a comment, and it won't be rendered }}
@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.

@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,
@dalethedeveloper
dalethedeveloper / gist:1503252
Created December 20, 2011 21:00
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(