Inspired by Tobias Van Schneider
A Pen by Wolfgang Born on CodePen.
/** | |
* Performs right-to-left composition, combining multiple functions into a single function. | |
* @function compose | |
* @param {...Function} args | |
* @returns {Function} | |
*/ | |
const compose = (...fns) => x => fns.reduceRight((output, fn) => fn(output), x, fns); | |
/** | |
* Performs left-to-right composition, combining multiple functions into a single function. Sometimes called `sequence`. Right-to-left composition is typically known as `compose`. |
const isFunction = fn => fn && Object.prototype.toString.call(fn) === '[object Function]'; | |
const isAsync = fn => fn && Object.prototype.toString.call(fn) === '[object AsyncFunction]'; | |
const isPromise = p => p && Object.prototype.toString.call(p) === '[object Promise]'; | |
const tap = f => x => { | |
f(x); | |
return x; | |
}; |
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2... | |
# This also works perfectly for all static file content in all projects | |
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config. | |
# Example: | |
# http://example.com - Main Laravel site as usual | |
# http://example.com/about - Main Laravel site about page as usual | |
# http://example.com/robots.txt - Main Laravel site static content as usual | |
# http://example.com/api/v1 - Lumen v1 api default / route | |
# http://example.com/api/v1/ - Lumen v1 api default / route |
#!/bin/bash | |
# Call this file with `bash ./project-create.sh project-name [service-name]` | |
# - project-name is mandatory | |
# - service-name is optional | |
# This will creates 4 directories and a git `post-receive` hook. | |
# The 4 directories are: | |
# - $GIT: a git repo | |
# - $TMP: a temporary directory for deployment |
<?php | |
function json_response($message = null, $code = 200) | |
{ | |
// clear the old headers | |
header_remove(); | |
// set the actual code | |
http_response_code($code); | |
// set the header to make sure cache is forced | |
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900"); |
axios({ | |
url: 'http://localhost:5000/static/example.pdf', | |
method: 'GET', | |
responseType: 'blob', // important | |
}).then((response) => { | |
const url = window.URL.createObjectURL(new Blob([response.data])); | |
const link = document.createElement('a'); | |
link.href = url; | |
link.setAttribute('download', 'file.pdf'); | |
link.click(); |
<header class="top sticky-wrapper"> | |
<ul class="nav"> | |
<li><a href="#sOne">side 1</a></li> | |
<li><a href="#sTwo">side 2</a></li> | |
<li><a href="#sThree">side-3</a></li> | |
<li><a href="#sFour">side-4</a></li> | |
</ul> | |
</header> | |
<section class="wrapper side-1"> | |
<a class="anchor" id="sOne"></a> |
This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)
Sister Document - Restore MySQL from Amazon S3 - read that next
this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc