Skip to content

Instantly share code, notes, and snippets.

View kirilkirkov's full-sized avatar
👽
writing alien code..

Kiril Kirkov kirilkirkov

👽
writing alien code..
View GitHub Profile
@kirilkirkov
kirilkirkov / gist:fc6e20f9cee38031753d3828386f23f8
Created August 28, 2022 07:25
JavaScript - Destructuring To Get The First And Last Element Of An Array In ES6
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>
@kirilkirkov
kirilkirkov / Kali-Linux-MacBook-Air-2017-Wifi-Drivers
Last active July 17, 2022 06:05
How to use MacBook Air 2017 - WiFi broadcom default wifi adapter on Kali Linux 2022.2
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!
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',
@kirilkirkov
kirilkirkov / gist:dcc281f642c179df608e04c24dedbeb6
Created February 27, 2022 07:48
When is admin_init Action ran?
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.
@kirilkirkov
kirilkirkov / Macbook Pro Dev PHP APACHE (5.6, 7.4, 8.0)
Last active October 27, 2021 19:50
Mac installation of php 5.6 and others - Big Sure, Mojave, Monterey .. etc.
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.
@kirilkirkov
kirilkirkov / gist:364d7247aef1c15abf7bc432689b22a1
Last active May 16, 2021 20:30
Udemy course video downloader
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.
A Closure is an anonymous function. Closures are often used as callback methods and can be used as a parameter in a function.
If you take the following example:
function handle(Closure $closure) {
$closure();
}
@kirilkirkov
kirilkirkov / Create_IPhone_Custom_Free_RingTones
Created May 29, 2020 17:22
Curtom ringtones for iPhone for free
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.
@kirilkirkov
kirilkirkov / ORM-Explain.MD
Last active October 10, 2024 05:58
Active record (Eloquent) vs Data mapper (Doctrine)

In the most of systems need to save data somewhere and in some way. ORM (Object-Relational Mapping), is the way of mapping the system to the database. ORM is the layer between database and application which deals with creating, updating, reading and deleting.

ActiveRecord is type of ORM that looks like that:

class User extends Eloquent {

}

$user = User::find(123);

@kirilkirkov
kirilkirkov / BindMethodIn.JS
Created April 27, 2020 11:21
How works .bind() in javasript
Bind creates a new function that will force the this inside the function to be the parameter passed to bind().
Here's an example that shows how to use bind to pass a member method around that has the correct this:
var myButton = {
content: 'OK',
click() {
console.log(this.content + ' clicked');
}
};