This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Change My Alibaba Page Title | |
// @namespace http://tampermonkey.net/ | |
// @version 0.5 | |
// @updateURL https://gist.githubusercontent.com/leavlzi/de515ac17871a822755c7bb85277210d/raw/4d481334360d354358cbb4f2af5af3788ef533d1/changeMyAlibabaTitle.js | |
// @downloadURL https://gist.githubusercontent.com/leavlzi/de515ac17871a822755c7bb85277210d/raw/4d481334360d354358cbb4f2af5af3788ef533d1/changeMyAlibabaTitle.js | |
// @description Change Alibaba title! | |
// @author Moming | |
// @match https://*.alibaba.com/* | |
// @grant none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Below code will work even if you don't know the exact sheet_names in the excel file. You can try this: | |
import pandas as pd | |
xls = pd.ExcelFile('myexcel.xls') | |
out_df = pd.DataFrame() | |
for sheet in xls.sheet_names: | |
df = pd.read_excel('myexcel.xls', sheet_name=sheet) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
fname = Path("c:\\test\\abc.txt") | |
print(fname.exists()) # true | |
print(fname.is_file()) # true | |
print(fname.is_dir()) # false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------- | |
Remove wpautop only for custom post types | |
-------------------------------------------*/ | |
function wpc_remove_autop_for_posttype( $content ) | |
{ | |
'newsletter' === get_post_type() && remove_filter( 'the_content', 'wpautop' ); | |
return $content; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'body_class', function( $classes ) { | |
foreach($classes as $key => $class) { | |
if( $class == "class-to-remove" ){ | |
unset($classes[$key]); | |
} | |
} | |
return $classes; | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Automatically add Alt Tag to WordPress Image Uploads | |
/* ------------------------------------ */ | |
add_action( 'add_attachment', 'ced_add_image_meta_data' ); | |
function ced_add_image_meta_data( $attachment_ID ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$new_meta_boxes = | |
array( | |
"description" => array( | |
"name" => "description", | |
"std" => "", | |
"title" => "description:"), | |
"keywords" => array( | |
"name" => "keywords", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add responsive container to embeds | |
/* ------------------------------------ */ | |
function alx_embed_html( $html ) { | |
return '<div class="video-container">' . $html . '</div>'; | |
} | |
add_filter( 'embed_oembed_html', 'alx_embed_html', 10, 3 ); | |
add_filter( 'video_embed_html', 'alx_embed_html' ); // Jetpack |
NewerOlder