Skip to content

Instantly share code, notes, and snippets.

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

Anunay Dahal anunay

🏠
Working from home
View GitHub Profile
@anunay
anunay / wp_permissions.sh
Created July 20, 2023 07:58 — forked from monkishtypist/wp_permissions.sh
WordPress file/folder permissions for Amazon EC2 Ubuntu instance
#!/bin/bash
# Location: Anywhere
# Add existing 'ubuntu' user to 'www-data' group
sudo usermod -a -G www-data ubuntu;
# Set the ownership of the files/directories
sudo chown -R www-data:www-data /var/www/html/;
# Set group ownership inheritance
@anunay
anunay / create_delivered_status.php
Created October 1, 2020 18:11 — forked from zorem/create_delivered_status.php
From this code snippet you can create custom order status delivered
<?php
// Add this code to your theme functions.php file or a custom plugin
add_action('init', 'register_order_status');
//add status after completed
add_filter('wc_order_statuses', 'add_delivered_to_order_statuses');
//Custom Statuses in admin reports
add_filter('woocommerce_reports_order_statuses', 'include_custom_order_status_to_reports', 20, 1);
// for automate woo to check order is paid
add_filter('woocommerce_order_is_paid_statuses', 'delivered_woocommerce_order_is_paid_statuses');
@anunay
anunay / migrate.sh
Created December 29, 2016 10:23 — forked from dj1020/migrate.sh
Upgrade MAMP to Mysql 5.7 tested by Ken Lin 2015/11/09
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.9-osx10.10-x86_64.tar.gz
tar xfvz mysql-5.7*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@anunay
anunay / coding-standards-example.php
Created June 22, 2016 18:52 — forked from RyanThompson/coding-standards-example.php
An example of the coding standards by AnomalyLabs.
<?php namespace Acme;
/**
* Class FooBar
*
* @link http://anomaly.is/foo-bar
* @author AnomalyLabs, Inc. <hello@anomaly.is>
* @author Ryan Thompson <ryan@anomaly.is>
* @package Acme
*/
@anunay
anunay / app.css
Last active November 16, 2017 16:30 — forked from kohki-shikata/app.css
Disable Responsiveness on Foundation 5 Raw
.row {
max-width: none;
width: 960px; /* any width you want */
}
<?php
$product=Mage::getModel("catalog/product");
$prod=$product->load($_product->getId());
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($prod);
$col = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
$total_qty=0;
foreach($col as $sprod){
$sprod=$product->load($sprod->getId());
<?php
// cleanup.php?clean=var
// cleanup.php?clean=log
$xml = simplexml_load_file('./app/etc/local.xml', NULL, LIBXML_NOCDATA);
$db['host'] = $xml->global->resources->default_setup->connection->host;
$db['name'] = $xml->global->resources->default_setup->connection->dbname;
$db['user'] = $xml->global->resources->default_setup->connection->username;
var gistPrefix = 'http://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('p.gist').map(function(n, p) {
p = $(p);
<?php
if ( ! function_exists('product_post_type') ) {
// Register Custom Post Type
function product_post_type() {
$labels = array(
'name' => _x( 'Products', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Product', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Product', 'text_domain' ),
'parent_item_colon' => __( 'Parent Product:', 'text_domain' ),