Skip to content

Instantly share code, notes, and snippets.

View malithmcr's full-sized avatar

Malith malithmcr

View GitHub Profile
127.0.0.1 modernwordpress.com.local
127.0.0.1 modernwordpress.de.local
127.0.0.1 modernwordpress.at.local
127.0.0.1 modernwordpress.it.local
@malithmcr
malithmcr / docker-compose.yml
Created May 1, 2020 12:24
WordPress Multisite docker-compose.yml
version: '3.3'
services:
# Database
db:
image: mysql:5.7
container_name: mysqldb
volumes:
- db_data:/var/lib/mysql
restart: always
@malithmcr
malithmcr / docker-compose.yml
Created July 26, 2019 14:53
Wordpress Docker Compose
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@malithmcr
malithmcr / ls
Created May 3, 2019 13:42 — forked from sblask/ls
ls with list, human readable sizes, hidden files and sorting
ls -lhac
@malithmcr
malithmcr / custom-oop-wp.php
Created February 18, 2019 13:08
Wordpress OOP
namespace Wpse240042\Type;
use WP_Post;
interface Book {
/**
* @return string
*/
public function title();
render() {
return(
<div className="App">
</div>
);
}
@malithmcr
malithmcr / Deploy With Git
Created November 11, 2018 10:21 — forked from calebbrewer/Deploy With Git
Manage and deploy a website with Git. I am using Lunux CentOS for my server.
Video on this Gist: https://www.youtube.com/watch?v=zvpLDuRY4ss&feature=c4-overview&list=UUj8_147vA3FQ1quI_CjciIQ
#Initialize a bare repo on the webserver. This would preferably be outside of your public website dir but if you are on a shared host you may not have that option. I like to make a folder just outside of the live folder called git. So for me it would look like this…
$ cd /var/www
$ mkdir git && cd git
$ git init –-bare
#Now you need to create a post-receive hook that will check out the latest tree from the Git repo you just setup into the /var/www/html folder where you want your website to be. You can make this whatever folder you want your code to end up in.
#This will create a file called post-receive in the hooks dir of the git repo.
@malithmcr
malithmcr / throttle.js
Last active October 25, 2018 14:06
javascript throttle
/**
* throttle
* @param {fn} callback func
* @param {wait} number - wait time
* @public
*/
function throttle(fn, wait) {
var time = Date.now();
return function() {
@malithmcr
malithmcr / header.phtml
Last active November 13, 2017 22:39
Send Magento order confirmation email programmatically
<?php
$order = new Mage_Sales_Model_Order();
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order->loadByIncrementId($incrementId);
try {
$order->sendNewOrderEmail();
} catch (Exception $ex) { }
@mixin responsive-font($responsive, $min, $max: false) {
$responsive-unitless: $responsive / ($responsive - $responsive + 1);
$dimension: if(unit($responsive) == 'vh', 'height', 'width');
$min-breakpoint: $min / $responsive-unitless * 100;
@media (max-#{$dimension}: #{$min-breakpoint}) {
font-size: $min;
}
@if $max {