Skip to content

Instantly share code, notes, and snippets.

View adelynx's full-sized avatar
🏠
Work from home

Adel Kedjour adelynx

🏠
Work from home
View GitHub Profile
@adelynx
adelynx / HMVC
Created May 25, 2012 19:38
Modular Extensions - HMVC for CodeIgniter
Modular Extensions makes the CodeIgniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory, that can be dropped into other CodeIgniter applications.
HMVC stands for Hierarchical Model View Controller.
Module Controllers can be used as normal Controllers or HMVC Controllers and they can be used to help you build view partials.
Features:
All controllers can contain an $autoload class variable, which holds an array of items to load prior to running the constructor. This can be used together with module/config/autoload.php, however using the $autoload variable only works for that specific controller.
The Modules::$locations array may be set in the application/config.php file. ie:
@adelynx
adelynx / radio_system.liq
Created April 26, 2019 00:25 — forked from GeekBrony/radio_system.liq
Liquidsoap Radio System
###########################################################################################
# Liquidsoap Radio System - built by GeekBrony, based from Liquidsoap. #
###########################################################################################
# Primary Features:
# - AutoDJ that crossfades between songs and has a 1/10 chance of landing on a Station ID/Jingle/Ad.
# - AutoDJ also selects tracks from "High Priority", "Low Priority" and "New Songs" playlists randomly.
# - Live Shows (that automatically dump to a directory)
# - Mic to speak over the stream.
# - Requests via Telnet/Web Interface, which have a 80-90% chance of queuing up when a song ends.
@adelynx
adelynx / a.md
Created June 11, 2019 15:13 — forked from danharper/a.md
Laravel Queue Supervisor

Install Supervisor with sudo apt-get install supervisor. Ensure it's started with sudo service supervisor restart.

In /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

Now update Supervisor with: sudo supervisorctl reread. And start using those changes with: sudo supervisorctl update.

@adelynx
adelynx / slugify.js
Created July 17, 2019 16:53 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáäâãåăæąçćčđďèéěėëêęǵḧìíïîįłḿǹńňñòóöôœøṕŕřßśšșťțùúüûǘůűūųẃẍÿýźžż·/_,:;'
const b = 'aaaaaaaaacccddeeeeeeeghiiiiilmnnnnooooooprrssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
@adelynx
adelynx / search_for_value.php
Created August 17, 2019 22:20 — forked from kjbrum/search_for_value.php
Check if a value exists in an array/object.
<?php
/**
* Check if an array is a multidimensional array.
*
* @param array $arr The array to check
* @return boolean Whether the the array is a multidimensional array or not
*/
function is_multi_array( $x ) {
if( count( array_filter( $x,'is_array' ) ) > 0 ) return true;
return false;
@adelynx
adelynx / search_for_value.php
Created August 17, 2019 22:20 — forked from kjbrum/search_for_value.php
Check if a value exists in an array/object.
<?php
/**
* Check if an array is a multidimensional array.
*
* @param array $arr The array to check
* @return boolean Whether the the array is a multidimensional array or not
*/
function is_multi_array( $x ) {
if( count( array_filter( $x,'is_array' ) ) > 0 ) return true;
return false;
@adelynx
adelynx / Linux
Created October 17, 2019 17:59
Tutorial Crack Sublime Text 3.2.1 Build 3207 Linux
# Linux (Using KDE Neon, Based on Ubuntu 18.04 a.k.a Bionic Beaver) #
1. Update your Sublime Text 3 to latest version (3.2.1 Build 3207)
2. Enter License
3. Open Terminal and execute command
4. "sudo chattr +i ~/.config/sublime-text-3/Local/License.sublime_license" to make immutable file
5. Done
----- BEGIN LICENSE -----
Member J2TeaM

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@adelynx
adelynx / selenium-php-webdriver-cheatsheet.md
Created November 21, 2019 10:05 — forked from aczietlow/selenium-php-webdriver-cheatsheet.md
Cheat sheet for using php webdriver (facebook/webdriver).

Webdriver PHP API workthough

  • Open a browser

    # start an instance of firefox with selenium-webdriver
    
    $browser_type = 'firefox'
    $host = 'http://localhost:4444/wd/hub'
    

$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => $browser_type);

@adelynx
adelynx / github.js
Created September 23, 2020 16:32 — forked from StephanHoyer/github.js
Commiting multiple files to github over API
'use strict';
var Octokat = require('octokat');
var extend = require('lodash/object/assign');
var defaults = {
branchName: 'master',
token: '',
username: '',
reponame: ''