We will use minimalistic Linux distribution called Alpine (5MB)
FROM alpine:latest
RUN apk --update add redis
import Vue from 'vue' | |
import Moment from 'moment' | |
Vue.directive('moment-ago', { | |
update (timestamp) { | |
this.el.innerHTML = Moment(timestamp).fromNow() | |
this.interval = setInterval(() => { | |
this.el.innerHTML = Moment(timestamp).fromNow() | |
}, 1000) |
/// Function to get next map item | |
/// returns next map item or fallback value if map, key or next item does not exist | |
/// Github Repo: https://github.com/elcheio/sass-map-get-next-prev | |
/// Node Module: https://www.npmjs.com/package/sass-map-get-next-prev | |
/// | |
/// @author Simon Koch <agorilla@me.com> | |
/// | |
/// Licensed under the MIT license. | |
/// | |
/// @access public |
<!-- http://lauragentry.com/blog/2010/07/30/how-to-create-a-wordpress-3-0-multisite-network-on-a-windows-server-using-sub-directories/ --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="WordPress Rule 1" stopProcessing="true"> | |
<match url="^index\.php$" ignoreCase="false" /> | |
<action type="None" /> | |
</rule> |
/** | |
* Note that this script is intended to be included at the *end* of the document, before </body> | |
*/ | |
(function (window, document) { | |
if ('open' in document.createElement('details')) return; | |
// made global by myself to be reused elsewhere | |
var addEvent = (function () { | |
if (document.addEventListener) { | |
return function (el, type, fn) { |
<?php // /app/Http/Middleware/Cors.php | |
namespace App\Http\Middleware; | |
use Closure; | |
class Cors { | |
public function handle($request, Closure $next) | |
{ | |
return $next($request) |
Here's how to make your site not load CSS and/or JS in IE older than 11:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=8,9,11">
<title>Page title</title>
<!--[if !IE]>-->
https://www.php.net/manual/en/function.sys-getloadavg.php#118673 | |
Function to get current CPU load as percentage value under Windows and Linux. | |
Note: Function is getServerLoad(). It will return a decimal value as percentage of current CPU load or NULL if something went wrong (e. g. insufficient access rights). | |
<?php | |
header("Content-Type: text/plain"); |
/** | |
* This script transforms animated webp files which are not widely supported yet | |
* to simple animated webm. Please state the source of your share this. | |
* | |
* # How this works | |
* This script depends on ffmpeg and libwebp provided by Google. Make sure | |
* they're in your PATH. | |
* | |
* The way this works is based off this answer https://askubuntu.com/a/1141049. | |
* It starts by extracting the input webp frames to a ./frames directory and, |
Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.
The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.
<script>
// require vue-resource...
new Vue({