Skip to content

Instantly share code, notes, and snippets.

View sirolad's full-sized avatar
🏠
Working from home

Surajudeen Akande sirolad

🏠
Working from home
View GitHub Profile
@sirolad
sirolad / sample.xml
Created March 22, 2017 20:14
Sample Well-formed Xml file
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<buildtime>2002-05-30T09:30:10.5</buildtime>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
@sirolad
sirolad / sample.xsd
Created March 22, 2017 20:20
Sample Russian Doll XSD design
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:dateTime" name="buildtime"/>
<xs:element name="book" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="author"/>
<xs:element type="xs:string" name="title"/>
@sirolad
sirolad / DomValidator.php
Last active March 22, 2017 22:29
A class to validate xml using DomDocument
<?php
class DOMValidator
{
/**
* @var string
*/
protected $feedSchema = __DIR__ . '/sample.xsd';
/**
<?php
$validator = new DomValidator;
$validated = $validator->validateFeeds('sample.xml');
if ($validated) {
echo "Feed successfully validated";
} else {
print_r($validator->displayErrors());
}
@sirolad
sirolad / XmlValidator.php
Last active March 22, 2017 22:28
A class to validate xml using XMLReader
<?php
class XmlValidator
{
/**
* @var string
*/
protected $feedSchema = __DIR__ . '/sample.xsd';
/**
* @var int
<?php
$validator = new XmlValidator;
$validated = $validator->validateFeeds('sample.xml');
if ($validated) {
echo "Feed successfully validated";
} else {
print_r($validator->displayErrors());
}
@sirolad
sirolad / index.html
Created July 20, 2017 17:50
AccountKit SDK
<script type="text/javascript" src="https://sdk.accountkit.com/en_US/sdk.js"></script>
@sirolad
sirolad / index.blade.php
Created July 20, 2017 17:53
Simple View for our app
<!DOCTYPE html>
<html>
<head>
<title>Account Kit (Laravel)</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<style type="text/css">
pre {
display: block;
padding: 9.5px;
@sirolad
sirolad / Handler.php
Created September 18, 2017 18:28
Modified global exception for JSON in app/Exceptions/Hander.php file
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
...
<?php
namespace App\Http\Requests;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Foundation\Http\FormRequest as LaravelFormRequest;