Skip to content

Instantly share code, notes, and snippets.

View Qoraiche's full-sized avatar
📈
Improving

Yassine Qoraiche Qoraiche

📈
Improving
View GitHub Profile
@Qoraiche
Qoraiche / ModelExport.php
Last active April 18, 2021 15:42
Laravel Excel Export Model Resource
<?php
namespace App\Exports;
use App\Http\Resources\ModelResource;
use App\Models\Model;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithHeadings;
@Qoraiche
Qoraiche / async-foreach.js
Created September 13, 2019 13:31 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@Qoraiche
Qoraiche / install-vultr-cli-centos7.md
Last active December 3, 2018 22:52
Install Vultr CLI on Centos 7

Introduction

Vultr CLI is a command line tool for using the Vultr API. It allows you to create and manage your virtual machines, SSH public keys, snapshots and startup scripts on your Vultr account. You can also use it to directly SSH into a Vultr virtual machine through the vultr ssh command.

Prerequisites

This tutorial assumes that you have access to an Centos 7 system, configured with a non-root user with sudo privileges as described in Initial Setup of a CentOS 7 Server.

Step 1 — Installing Go

@Qoraiche
Qoraiche / wp-mediaelement.js
Last active May 6, 2018 18:02
mediaelement wordpress default Volume using startVolume parameter
/*
!function(a,b){function c(){function a(){"undefined"=typeof _wpmejsSettings&&(
!c=b.extend(0,{},_wpmejsSettings)),c.classPrefix="mejs-",c.success=c.success||
!function(a){var b,c;a.rendererName&&-1==a.rendererName.indexOf("flash")&&(b=a
!.attributes.autoplay&&"false"==a.attributes.autoplay,c=a.attributes.loop&&"fa
!lse"==a.attributes.loop,b&&a.addEventListener("canplay",function(){a.play()},
!1),c&&a.addEventListener("ended",function(){a.play()},1))},c.customError=func
!tion(a,b){if(-1==a.rendererName.indexOf("flash")||-1==a.rendererName.indexOf(
!"flv"))return'<a href="'+b.src+'">'+mejsL10n.strings["mejs.download-
!video"]+"</a>"},b(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-
@Qoraiche
Qoraiche / redhat-nginx-init
Created April 7, 2018 19:06
RHEL, Fedora, CentOS. Tested on CentOS 5.
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: NGINX is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@Qoraiche
Qoraiche / red5-autostart-vultr-tutorial
Last active January 20, 2018 16:18
red5-autostart-vultr-tutorial
#!/bin/sh
### BEGIN INIT INFO
# Provides: red5
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Red5 server
# Red5 version : 1.0.9
@Qoraiche
Qoraiche / subscription-payment-complete.php
Last active March 31, 2018 14:44
Woocommerce_subscription when a payment is made on a subscription
/*
* woocommerce_subscription_payment_complete action hook
* Triggered when a payment is made on a subscription
* @param $subscription
*/
add_action( 'woocommerce_subscription_payment_complete', 'update_user', 10, 1 );
function update_user($subscription) {
@Qoraiche
Qoraiche / smooth-font.scss
Last active February 21, 2017 17:26
use font-smoothing for a smooth font
@mixin text-rendring(){
text-rendering: optimizeLegibility !important;
-webkit-font-smoothing: antialiased !important;
}
body {
@include text-rendring();
}