This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The easiest lay to get first and last element from an array in javascript with one line code. | |
<script> | |
const meals = ['apple', 'orange', 'bananna']; | |
const {length, 0: first, [length - 1]: last} = meals; | |
console.log(first, last) | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt install broadcom-sta-dkms | |
sudo modprobe -r b43 ssb wl | |
sudo modprobe wl | |
This will enable you wifi ;) Enjoy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const VueLoaderPlugin = require('vue-loader/lib/plugin') | |
const isDevelopment = true | |
const autoprefixer = require('autoprefixer'); | |
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
module.exports = { | |
entry: { | |
app: './resources/js/entry-server.js', | |
}, | |
mode: isDevelopment ? 'development' : 'production', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
admin_init is triggered when a user accesses the admin area. It is the first hook to be triggered. It can be used in cases like: | |
We want to block access to the admin panel for users that do not have the Administrator Role. | |
We want automatic redirection of users lacking the specified capability, to the homepage. | |
We want to register a new setting for use by a plugin. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Origin source: https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions | |
Brew packages - https://github.com/shivammathur/homebrew-php | |
Part 1: macOS 11.0 Big Sur Web Development Environment | |
Developing web applications on macOS is a real joy. There are plenty of options for setting up your development environments, including the ever-popular MAMP Pro that provides a nice UI on top of Apache, PHP and MySQL. However, there are times when MAMP Pro has slow downs, or out of date versions, or is simply behaving badly due to its restrictive system of configuration templates and non-standard builds. | |
It is times like these that people often look for an alternative approach, and luckily there is one, and it is relatively straight-forward to setup. | |
In this blog post, we will walk you through setting up and configuring Apache 2.4 and multiple PHP versions. In the second blog post in this two-post series, we will cover MySQL, Apache virtual hosts, APC caching, and Xdebug installation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/r0oth3x49/udemy-dl | |
1. If has error: | |
ModuleNotFoundError: No module named 'm3u8' | |
-- Run this: pip install -r requirements.txt | |
2. If has error: | |
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download from https://www.zedge.net/ringtones/ | |
Drag and drop to ITunes - Library -> Songs | |
Click on it and then click File (at TOP - Left right of the macbook) | |
Click convert and Create ACC | |
Right click on the new file in Itunes and click Open in Finder | |
Copy the file to the Downloads directory (for example) | |
Edit m4a file and make it with extension - m4r | |
Open Finder and click on the Iphone in the Locations | |
In general tab drag and drop the new .m4r file. | |
Click Sync. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install required dependencies | |
sudo apt-get install build-essential curl git python libglib2.0-dev | |
cd /tmp | |
# Install depot_tools first (needed for source checkout) | |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
export PATH=`pwd`/depot_tools:"$PATH" | |
# Download v8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You may receive a response such as this when running Nginx and php-fpm after a fixed amount of time (default = 60s). | |
Connection timed out | |
[error] upstream timed out (110: Connection timed out) while reading upstream, client: x.x.x.x, server: host.tld, request: "POST /script.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", ... | |
The “Connection timed out” usually happens when running large scripts, that need a lot of time for processing – such as import jobs parsing large XML or CSV files. The problem is that Nginx waits by default for 60s on the fastCGI response. If it takes too long, the request is stopped. The “Connection timed out” error means that Nginx hit a timeout before it received a response from the FastCGI backend. | |
You can change the time Nginx waits for the FastCGI backend, by changing the fastcgi_read_timeout parameter in the general nginx.conf. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// RFC base64 encode - https://tools.ietf.org/html/rfc7515#appendix-C | |
$secret = 'kiro'; | |
// Make base64 valid for url's | |
function base64UrlEncode($text) | |
{ | |
return str_replace( |