Skip to content

Instantly share code, notes, and snippets.

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

Rituparna sonowal eagleyed

🏠
Working from home
  • Individual
  • Kolkata, India
View GitHub Profile
@eagleyed
eagleyed / edit-any-woocommerce-order
Created March 5, 2018 20:46
Edit any order in woocommerce -- helpful in rare cases!!
add_filter( 'wc_order_is_editable', '__return_true', 99999 );
@eagleyed
eagleyed / nginx-allow-to-update-install
Created March 22, 2018 23:14
Change ownership of your application folder so that it can allow update / install plugins..
sudo chown -R www-data:www-data /var/www/html/your-app
@eagleyed
eagleyed / gist:6a448125aaa1fb49b791ad7cde8162c4
Created May 15, 2019 13:25 — forked from hissy/gist:7352933
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@eagleyed
eagleyed / hide_menu.text
Created April 25, 2020 10:52
Hide plugin menus or any admin page If you want
function hide_admin_menus_for_all( $context ) {
// Core Menus
remove_menu_page( 'index.php' ); //Dashboard
remove_menu_page( 'edit.php' ); //Posts
remove_menu_page( 'upload.php' ); //Media
//etc.
// Plugins
remove_menu_page( 'plugin-page-slug' );
@eagleyed
eagleyed / Woocommerce + constant contact checkbox levl
Created April 27, 2020 11:49
Change the level on the checkout page
function connormagyar_override_ctct_label( $args, $key, $value ) {
if ( 'customer_newsletter_opt_in' !== $key ) {
return $args;
}
$args['label'] = 'SOME CUSTOM LABEL';
return $args;
}
add_filter( 'woocommerce_form_field_args', 'connormagyar_override_ctct_label', 10, 3 );
@eagleyed
eagleyed / docker-help.md
Created May 4, 2020 21:28 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@eagleyed
eagleyed / scrapy.md
Created May 5, 2020 10:00 — forked from bradtraversy/scrapy.md
Scrapy commands and code
@eagleyed
eagleyed / node_nginx_ssl.md
Created May 5, 2020 10:03 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@eagleyed
eagleyed / python_heroku.MD
Created May 5, 2020 10:12 — forked from bradtraversy/python_heroku.MD
Python & Postgres Heroku Deployment

Python Heroku Deployment

Steps to create a postgres database and deply a Python app to Heroku

Install guinicorn locally

pipenv install gunicorn
or
pip install gunicorn

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database