Skip to content

Instantly share code, notes, and snippets.

View nickolaz's full-sized avatar

Nicolas Ayala nickolaz

View GitHub Profile
@krugerdavid
krugerdavid / cellphonepy.js
Last active December 13, 2022 13:34
Regex for validate cellphones numbers from Paraguay
// Jquery Validator
$.validator.addMethod('phonePY', function(phone_number, element) {
var regex = /^((\+595|0)9([6-9][1-6])\d{6})$/;
return this.optional(element) || phone_number.length <= 13 && regex.test(phone_number);
}, 'Please write a valid cell phone number.');
@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,
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active July 20, 2024 16:44
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

#!/bin/zsh
export GOPATH=$HOME/go
PATH=/usr/local/opt/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:$GOPATH/bin
CDPATH=.:~
export WORKON_HOME=~/virtualenvs
# sourcing virtualenvwrapper takes a second. that's too long when starting a new shell
@elithrar
elithrar / authserver.go
Last active June 30, 2021 07:12
HTTP Basic Auth example in Go (based on http://stackoverflow.com/a/21937924/556573 + bespoke middleware implementation)
package main
import (
"encoding/base64"
"github.com/gorilla/mux"
"net/http"
"strings"
)
func main() {
@mycodeschool
mycodeschool / DoublyLinkedList.c
Created November 12, 2013 11:38
Doubly Linked List implementation in C
/* Doubly Linked List implementation */
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
};