Skip to content

Instantly share code, notes, and snippets.

@spekkionu
spekkionu / audio-player.js
Last active Nov 1, 2018
Audio player component
View audio-player.js
/**
* 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
View build.php
<?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 Apr 14, 2016
Get breadcrumbs for nested set
View breadcrumbs.sql
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 Nov 19, 2015
Contact From with AJAX
View contact.php
<!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 Oct 9, 2014
Symfony HttpFoundation Zend\Authentication\Storage adapter
View SymfonySession.php
<?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 Oct 9, 2014
Standalone validation using laravel validation component
View composer.json
{
"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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View designer.html
<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 Feb 3, 2014
Build Zend Framework 1.x as phar
View autoload.php
<?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 Feb 3, 2014
Build swiftmailer as phar
View build.php
<?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);