Skip to content

Instantly share code, notes, and snippets.

View malkafly's full-sized avatar
🏠
Working from home

d. malk malkafly

🏠
Working from home
View GitHub Profile
@malkafly
malkafly / set_date
Created May 7, 2018 05:13
Ajustando Timezone para Brasil/SP
#set datetime
sudo date -s "7 MAY 2018 02:13:00"
#read
timedatectl
#set
ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
@malkafly
malkafly / guz.php
Created March 6, 2018 16:43 — forked from igoralves1/guz.php
Consuming API endpoints with Laravel 5+ AND Guzzle\Http
/*
Installation -> http://docs.guzzlephp.org/en/latest/overview.html#installation
https://www.youtube.com/watch?v=GunXVUqvO-s
https://www.udemy.com/http-clients-with-laravel-use-and-consume-services-and-apis/
add Guzzle as a dependency using the composer.phar CLI:
@malkafly
malkafly / install.sh
Created March 3, 2018 02:34
Installs LAMP with PHP 5.6 on Ubuntu 16.04
#!/bin/bash
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y apache2
sudo ufw allow in "Apache Full"
sudo apt-get install -y mysql-server
# After running this command, select (Y), option 2, then (Y) for the rest of the prompts.
sudo mysql_secure_installation
@malkafly
malkafly / woocommerce-custom-shipping-method.php
Created February 20, 2018 18:10 — forked from alordiel/woocommerce-custom-shipping-method.php
Adding custom shipping method for WooCommerce (v. 3.2.6)
<?php
//Works with WooCommerce 3.2.6
add_action( 'woocommerce_shipping_init', 'econt_shipping_method' );
function econt_shipping_method() {
if ( ! class_exists( 'WC_Econt_Shipping_Method' ) ) {
class WC_Econt_Shipping_Method extends WC_Shipping_Method {
public function __construct( $instance_id = 0 ) {
$this->instance_id = absint( $instance_id );
$this->id = 'econt';//this is the id of our shipping method
@malkafly
malkafly / Laravel PHP7 LEMP DigitalOcean.md
Created February 20, 2018 12:02 — forked from naveenyagati/Laravel PHP7 LEMP DigitalOcean.md
Configuration for Installing Laravel with LEMP on Ubuntu 16.04 on Digital Ocean

Steps to install latest Laravel with LEMP on Digital Ocean Ubuntu 16.4

This tutorial is made based upon my experiences.In DigitalOcean Firewall in Configured by default so no changes are needed.Let's Encrypt has been pre-installed for us in Digita Ocean, please see: http://do.co/le-nginx

Install PHP 7 on Ubuntu

sudo apt-get update
sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get install zip unzip
sudo apt-get install -y php7.0 php7.0-fpm php7.0-mysql php7.0-zip php7.0-gd
@malkafly
malkafly / Laravel PHP7 LEMP and Mysql
Created February 20, 2018 11:48 — forked from achmadfatoni/Laravel PHP7 LEMP and Mysql
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x and Mysql
#Steps to install latest Laravel, LEMP on AWS Ubuntu 14.4 version.
This tutorial is the improvised verision of this [tutorial on Digitalocean](https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04) based on my experience.
## Install PHP 7 on Ubuntu
Run the following commands in sequence.
```
sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
/*!
*
* Version :
* Emmanuel B. (www.emmanuelbeziat.com)
* https://github.com/EmmanuelBeziat/
**/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
@malkafly
malkafly / wp-welcome.php
Created December 26, 2017 16:51 — forked from danielpataki/full-code.php
Adding Your Own welcome screen
register_activation_hook( __FILE__, 'welcome_screen_activate' );
function welcome_screen_activate() {
set_transient( '_welcome_screen_activation_redirect', true, 30 );
}
add_action( 'admin_init', 'welcome_screen_do_activation_redirect' );
function welcome_screen_do_activation_redirect() {
// Bail if no activation redirect
if ( ! get_transient( '_welcome_screen_activation_redirect' ) ) {
return;
@malkafly
malkafly / invert.js
Created December 11, 2017 12:03
Invert color of all elements
javascript: (
function () {
//based on https://stackoverflow.com/questions/4766201/javascript-invert-color-on-all-elements-of-a-page
// the css we are going to inject
var css = 'html {-webkit-filter: invert(100%);' +
'-moz-filter: invert(100%);' +
'-o-filter: invert(100%);' +
'-ms-filter: invert(100%); }',
head = document.getElementsByTagName('head')[0],
@malkafly
malkafly / encrypt-decrypt.php
Last active December 3, 2017 22:53 — forked from richjenks/encrypt-decrypt.php
Simple PHP Encryption & Decryption
<?php
/**
* Simple PHP Encryption functions
*
* Attempts to be as secure as possible given:
*
* - Key can be any string
* - No knowledge of encryption is required
* - Only key and raw/encrypted string is needed at each end