Skip to content

Instantly share code, notes, and snippets.

View spekkionu's full-sized avatar

Jonathan Bernardi spekkionu

View GitHub Profile
@spekkionu
spekkionu / audio-player.js
Last active November 1, 2018 03:48
Audio player component
/**
* Copyright 2018 Jonathan Bernardi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
@spekkionu
spekkionu / build.php
Created April 5, 2017 22:47
plates phar
<?php
$srcRoot = realpath(__DIR__."/vendor");
$buildRoot = realpath(__DIR__);
class MyRecursiveFilterIterator extends RecursiveFilterIterator {
public function accept() {
if(!$this->current()->isFile()){
return true;
}
@spekkionu
spekkionu / breadcrumbs.sql
Created April 14, 2016 06:59
Get breadcrumbs for nested set
SELECT
GROUP_CONCAT(
ancestor.name
ORDER BY ancestor.lft ASC
SEPARATOR ' > '
),
child.*
FROM `categories` child
JOIN `categories` ancestor
ON child.lft >= ancestor.lft
@spekkionu
spekkionu / contact.php
Created November 19, 2015 03:54
Contact From with AJAX
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Contact Us</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<script src='//www.google.com/recaptcha/api.js' async defer></script>
</head>
@spekkionu
spekkionu / SymfonySession.php
Created October 9, 2014 21:41
Symfony HttpFoundation Zend\Authentication\Storage adapter
<?php
namespace Spekkionu\Zend\Authentication\Storage;
use Zend\Authentication\Storage\StorageInterface;
use Symfony\Component\HttpFoundation\Session\Session;
class SymfonySession implements StorageInterface
{
/**
* Default session namespace
@spekkionu
spekkionu / composer.json
Created October 9, 2014 20:07
Standalone validation using laravel validation component
{
"name": "spakkionu/validate",
"description": "Validation Test",
"require": {
"illuminate/validation": "~4.2.9"
},
"license": "MIT",
"authors": [
{
"name": "Jonathan Bernardi",
@spekkionu
spekkionu / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@spekkionu
spekkionu / designer.html
Created September 3, 2014 16:01
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@spekkionu
spekkionu / autoload.php
Created February 3, 2014 21:05
Build Zend Framework 1.x as phar
<?php
require('Zend'.DIRECTORY_SEPARATOR.'Loader'.DIRECTORY_SEPARATOR.'AutoloaderFactory.php');
Zend_Loader_AutoloaderFactory::factory(array(
'Zend_Loader_StandardAutoloader' => array(
'prefixes' => array(
'Zend' => 'Zend'
)
)
@spekkionu
spekkionu / build.php
Created February 3, 2014 20:55
Build swiftmailer as phar
<?php
$srcRoot = realpath(__DIR__."/vendor/swiftmailer/swiftmailer/lib");
$buildRoot = realpath(__DIR__);
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($srcRoot, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY);
echo "Build SwiftMailer phar\n";
$phar = new Phar($buildRoot.'/swiftmailer.phar', 0, 'swiftmailer.phar');
$phar->buildFromIterator($iterator, $srcRoot);