Skip to content

Instantly share code, notes, and snippets.

View LeoOnTheEarth's full-sized avatar
🎯
Focusing

Leo LeoOnTheEarth

🎯
Focusing
View GitHub Profile
@LeoOnTheEarth
LeoOnTheEarth / swiftmailer.php
Last active September 1, 2022 06:09
SwiftMailer 範例
<?php
// 需要先安裝 swiftmailer
// composer require "swiftmailer/swiftmailer:^6.0"
require __DIR__ . '/vendor/autoload.php';
// Create the Transport
$transport = (new Swift_SmtpTransport('email-smtp.us-east-1.amazonaws.com', 587, 'tls'))
->setUsername('username')
@LeoOnTheEarth
LeoOnTheEarth / wheel-of-fortune.js
Last active March 16, 2020 06:38
Wheel Of Fortune!!
;$(function() {
/**
* @param {Element} wheel
*/
(function initWheelOfFortune() {
$('[data-toggle="wheel-of-fortune"]').each(function () {
var $wheel = $(this);
var angle = parseInt($wheel.data('current-angle')) || 0;
var stopAngle = angle;
var runDegree = 7;
/** Basic Theme Styles **/
.easy-cover-flow {
overflow: hidden;
position: relative;
margin: 0 auto;
}
.easy-cover-flow .item {
position: absolute;
top: 0;
@LeoOnTheEarth
LeoOnTheEarth / FormHandler.js
Last active May 11, 2018 11:02
FormHandler for handle form template operation
;(function($) {
var DefaultValueProcessor = {
support: function($elem)
{
return true;
},
reset: function($elem)
{
$elem.val('');
},
@LeoOnTheEarth
LeoOnTheEarth / Article.php
Created September 11, 2017 02:39
Symfony3 + Doctrine Example
<?php
// AppBundle/Entity/Article.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use AppBundle\Entity\Author;
/**
* @ORM\Entity
* @ORM\Table(name="articles")
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
<title>Video Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/LeoOnTheEarth/fd57ce7daa9ecd2d8f6482f40772e10b/raw/bb3904e33f087c807510986e332b66b22a9a7b54/video.js"></script>
</head>
<body style="margin:0;">
<?php
// src/AppBundle/Controller/PrescriptionController.php
namespace AppBundle\Controller;
use AppBundle\Propel\Prescription;
use AppBundle\Propel\PrescriptionQuery;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Form\Type\PrescriptionType;
@LeoOnTheEarth
LeoOnTheEarth / symfony-form-example.php
Created April 26, 2016 04:27
Symfony Form Example
<?php
/**
* Part of sf-form project.
*
* @copyright Copyright (C) 2011 - 2016 SMS Taiwan, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
require __DIR__ . '/vendor/autoload.php';
@LeoOnTheEarth
LeoOnTheEarth / index.html
Created April 21, 2016 08:45
Auto page break with Flex Box Table
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<style>
.table { page-break-inside: auto; }
.row { page-break-inside: avoid; page-break-after: auto; }
.row {
@LeoOnTheEarth
LeoOnTheEarth / composer.json
Last active April 12, 2016 08:10
Propel2 Demo
{
"require": {
"propel/propel": "2.0.0-alpha5",
"twig/twig": "~1.24"
},
"autoload": {
"psr-4": {
"": "generated-classes/"
}
}