Skip to content

Instantly share code, notes, and snippets.

View madeinnordeste's full-sized avatar
:octocat:
Coding

Luiz Alberto S. Ribeiro madeinnordeste

:octocat:
Coding
View GitHub Profile
@madeinnordeste
madeinnordeste / create_patients_table.php
Created January 26, 2017 17:09
Laravel 5.3 Migration Example
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePatientsTable extends Migration
{
/**
* Run the migrations.
@madeinnordeste
madeinnordeste / PatientFactory.php
Created January 26, 2017 17:07
Laravel 5.3 Factory Example
<?php
$factory->define(App\Patient::class, function (Faker\Generator $faker) {
$_marital_statuses = [
'Solteiro(a)',
'Casado(a)',
'Divorciado(a)',
'Viúvo(a)',
'Separado(a)',
@madeinnordeste
madeinnordeste / PatientRepository.php
Created January 26, 2017 17:06
Laravel 5.3 Repository Example
<?php
namespace App\Repositories;
use App\Patient;
use Validator;
use Illuminate\Support\Facades\Input;
class PatientRepository
{
/**
@madeinnordeste
madeinnordeste / PatientController.php
Created January 26, 2017 17:05
Laravel 5.3 Resource Controller Example
<?php
namespace App\Http\Controllers;
use App\State;
use App\Patient;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use App\Repositories\PatientRepository;
@madeinnordeste
madeinnordeste / switchHDMI.py
Created November 1, 2016 20:40
RaspberryPi3 - Switch HDMI with Relay
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.output(4, GPIO.HIGH)
time.sleep(0.5)
GPIO.cleanup()
@madeinnordeste
madeinnordeste / get_hamachi_ip.php
Created October 18, 2016 16:32
Get Logme.in Hamachi IP from machine with PHP
<?php
// Hamachi Website - https://www.vpn.net/
$command = "ifconfig ham0 | grep 'inet end.' | cut -d: -f2 | awk '{ print $1}'";
$ip = shell_exec($command);
echo "Hamachi ip: ".$ip;
@madeinnordeste
madeinnordeste / 11-show-ip
Created July 5, 2016 14:24
Show linux machine ip and xip.io domain on ssh login
#!/bin/sh
#
# Save in: /etc/update-motd/11-show-ip
#
IP="$(ip address show eth1 | grep 'inet ' | sed -e 's/^.*inet //' -e 's/\/.*$//')"
echo ""
echo "Show ip/local domain:"
echo "- - - - - - - - - - - - - "
@madeinnordeste
madeinnordeste / send-email.php
Created April 24, 2015 14:38
PHP-Send-Email
<?php
$from = '[email protected]';
$to = '[email protected]';
$subject = 'subject email';
$message = 'email message here';
$headers = 'From: '.$from . "\r\n" .
'Reply-To: '.$from . "\r\n" .
'X-Mailer: PHP/' . phpversion();
<?php
/*Four:*/
//in php script you have adjust to receive the correct parameter: $_POST['email']
include 'briteverify.com.class.php';
$brite = new Brite_Verify($_POST['email'], 'YOU-API-KEY');
$result = $brite->verify();
echo $result;
/*One: */
var data = $("#emailaddress:input").serialize();
//maybe is not necessary use serialize() method;
var data = $("#emailaddress").val();
/*Two:*/
//to submit for php script you can use: