Skip to content

Instantly share code, notes, and snippets.

View wapcrazut's full-sized avatar
🍄
Leveling up

Williams Abraham wapcrazut

🍄
Leveling up
View GitHub Profile
@wapcrazut
wapcrazut / run.sh
Created July 25, 2023 09:08
Run PHPUnit test repeatedly
# https://github.com/sebastianbergmann/phpunit/issues/5174
while php vendor/bin/phpunit tests/ExampleTest.php --stop-on-failure; do echo; done
@wapcrazut
wapcrazut / unfollow.py
Created November 14, 2020 12:29
Tweepy - Unfollow people don't follow you back
#! /usr/bin/env python
# Based on Jamieson Becker's unfollow script http://pastebin.com/CxUDMtMi
# Python 3 compatible.
import time
import tweepy
import sys
auth = tweepy.auth.OAuthHandler(
@wapcrazut
wapcrazut / functions.php
Last active May 12, 2020 13:52
Force Wordpress HTTP Requests to always verify SSL
<?php
// Add this to your child's theme functions file
// Source: https://surniaulula.com/2018/apps/wordpress/fix-sslverifyfalse-for-plugin-theme-update-checks/
add_filter( 'https_ssl_verify', '__return_true', PHP_INT_MAX );
add_filter( 'http_request_args', 'http_request_force_ssl_verify', PHP_INT_MAX );
function http_request_force_ssl_verify( $args ) {
$args['sslverify'] = true;
return $args;
@wapcrazut
wapcrazut / Serializer.ts
Created April 29, 2020 08:09
TypeScript Form Serializer
/*
* Serialize all form data into a query string (TypeScript version)
* Based on the Chris Fernandi function.
* 2020 Williams Crazut, MIT License, https://webdeveloperguy.com
*/
function serialize(form: HTMLFormElement)
{
let serialized = [];
for (let i = 0; i < form.elements.length; i++) {
@wapcrazut
wapcrazut / webpack.config.js
Created December 19, 2019 11:46
Multiple Webpack file output
module.exports = {
//...
entry: {
'build/application/bundle': './src/application', // will be ./build/application/bundle.js,
'build/library/bundle': './src/library`'// will be ./build/library/bundle.js,
'build/assets/app.core': './src/assets/theme/app.core.scss`'// Should be ./build/assets/app.core.css,
},
output: {
@wapcrazut
wapcrazut / .htaccess
Created December 14, 2019 15:54
Redirect to default public directory Symfony 4 / Laravel with Apache
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
# Alternative
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
@wapcrazut
wapcrazut / DatePickerType.php
Created December 3, 2019 08:25
HTML5 Native datepicker for Symfony 4
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@wapcrazut
wapcrazut / doctrine.yaml
Created November 24, 2019 21:33
Disable SQL ONLY_FULL_GROUP_BY in Doctrine (Symfony)
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
options:
@wapcrazut
wapcrazut / .env
Last active October 21, 2019 12:58
Laradock Worskpace and PHP-FPM file parts for adding ZMQ (ONLY FOR PHP 7.2)
### WORKSPACE #############################################
WORKSPACE_INSTALL_ZMQ=true
### PHP_FPM ###############################################
PHP_FPM_INSTALL_ZMQ=true
### APACHE ################################################
APACHE_HOST_ZMQ_PORT=5555
@wapcrazut
wapcrazut / centos7_install_lamp.sh
Last active August 31, 2019 21:06
Install LAMP on CentOs 7
## INIT
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-releas nano wget
## SQL
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service