Skip to content

Instantly share code, notes, and snippets.

View jhoanborges's full-sized avatar

Jhoan Borges jhoanborges

View GitHub Profile
@jhoanborges
jhoanborges / alt-callback-pass.md
Created December 3, 2018 16:02
Alternative ways to pass a callback to a function in Javascript

#Alternative ways to pass a callback to a function in Javascript

Javascript is extremely flexible, encouraging us to find alternatives to almost any possible expression or statement. For example, passing a callback function to another function can be done in different ways.

Because a function is an object in Javascript, it can be passed to another function as an argument and executed later. Callbacks let us defer the code execution to the moment it's really needed.

function waitAndCall(func)
{
 setTimeout(func,parseInt(Math.random()*10000));
@jhoanborges
jhoanborges / honeypot-antispam.php
Created January 28, 2019 14:24 — forked from andrewlimaza/honeypot-example.php
Simple honeypot for an HTML form using PHP
<?php
//check if form was sent
if($_POST){
$to = 'some@email.com';
$subject = 'Testing HoneyPot';
$header = "From: $name <$name>";
$name = $_POST['name'];
@jhoanborges
jhoanborges / Estados y Municipios
Created March 4, 2019 21:44 — forked from coffe67/Estados y Municipios
Estados y Municipios Mexico (SQL), La relación es un estado tiene n municipios.
-- Host: localhost:8889
-- Generation Time: Aug 29, 2014 at 05:26 PM
-- Server version: 5.5.34
-- PHP Version: 5.5.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Database: `estados_municipios`
[
{
"id": 8,
"nombre": "Jorge Luis Mora Hernandez",
"especialista_id": "Médico General",
"municipio_id": "",
"direccion": "Calle Obispo de las casas",
"lat": "",
"lng": "",
"cedula": "89865",
package com.demotxt.myapp.myapplication.model;
/**
* Created by Aws on 22/02/2018.
*/
public class Anime {
private String name ;
private String description;
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cardview_id"
android:clickable="true"
android:layout_width="120dp"
android:layout_height="190dp"
android:layout_margin="5dp"
>
<LinearLayout
package com.demotxt.myapp.myapplication.adapters;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
package com.demotxt.myapp.myapplication.activities;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
public function logo(Request $request){
//http://plugins.krajee.com/file-input#ajax-uploads
try{
$id = 1;
$file=$_FILES['fileBlob'];
//se valida que el usuario sea de status 1 = aprobado y que no sea status 2=ya se recibieron datos
@jhoanborges
jhoanborges / laravel-password-reset.md
Created February 4, 2020 06:28 — forked from JohnnyWalkerDigital/laravel-password-reset.md
Laravel: Fix password reset (User email not sent)

Here's how to overcome this common gotcha: The default password reset system not working out of the box with Laravel 5.x (as you're not sent the user's password), without having to alter altering vendor/core. Here's how to make it work as you'd expect it to without changing any vendor files.

1. Create own notification

Firstly create a new notification for your app:

php artisan make:notification ResetPassword

Then open the newly created file: app\Notifications\ResetPassword.php and make the following changes: