Skip to content

Instantly share code, notes, and snippets.

@summerblue
summerblue / gist:e34f1c79e100c5deac20
Last active April 23, 2017 12:46
Using Artisan for backup-manager Auto naming convenience

Introduction

backup-manager is an excelent package, but lack of auto naming feature, here is a workaround using Laravel's Artisan command line tool.

Creating the command

This is the command what we are going to accomplish:

@maramtech-sublime
maramtech-sublime / DbmigrateController.php
Created March 5, 2014 14:34 — forked from bruceoutdoors/DbmigrateController.php
PHP: Converts existing MySQL database to migrations in Laravel 4.
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@jeremyjbowers
jeremyjbowers / varnish-complex.vcl
Created December 31, 2011 05:27
A complex Varnish configuration file.
/*
*
* Instead of a single backend, let's set up a more complex multi-server director.
* This director will randomly assign each request to one of three application servers.
*
*/
director backend random {
.retries = 5;
{
.backend = {
// shorter vars for brevity
var a = image.naturalWidth,
b = image.naturalHeight,
c = maxImageWidth,
d = maxImageHeight,
r1 = a / b, // image aspect ratio
r2 = c / d; // container aspect ratio
// determine which dimension is the limiting factor
// according to the aspect ratio comparison and
try {
new CustomEvent("IE has CustomEvent, but doesn't support constructor");
} catch (e) {
window.CustomEvent = function(event, params) {
var evt;
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
@bruceoutdoors
bruceoutdoors / DbmigrateController.php
Last active June 2, 2019 12:30
Laravel 4 Convert existing MySQL database to migrations. This is a fork of Christopher Pitt's work http://laravelsnippets.com/snippets/convert-an-existing-mysql-database-to-migrations, which is based off michaeljcalkins's work at http://paste.laravel.com/1jdw#sthash.0nEgQzQR.dpuf. His original source code doesn't really work out of the box in my…
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@kristoferjoseph
kristoferjoseph / webpack.config.js
Created June 6, 2016 18:28
postcss part of my webpack config
postcss: function() {
return [
postcssImport({
onImport: function (files) {
files.forEach(this.addDependency)
}.bind(this)
}),
customProperties(),
autoprefixer
]
@jmas
jmas / object-to-form-data.js
Created May 15, 2016 08:19 — forked from ghinda/object-to-form-data.js
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@nektro
nektro / createImageBitmap.js
Created November 7, 2017 01:14
Edge and Safari Polyfill for createImageBitmap
/* Safari and Edge polyfill for createImageBitmap
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
*/
if (!('createImageBitmap' in window)) {
window.createImageBitmap = async function(blob) {
return new Promise((resolve,reject) => {
let img = document.createElement('img');
img.addEventListener('load', function() {
resolve(this);
});

PHPExcel Cheat Sheet

Documentation

Snippets

Install.

composer require phpoffice/phpexcel