Skip to content

Instantly share code, notes, and snippets.

View llity's full-sized avatar
🍉
I may be slow to respond.

Loong llity

🍉
I may be slow to respond.
View GitHub Profile
@bondarolik
bondarolik / functions.php
Created August 30, 2012 03:17
Better SEO wp_title()
# Rewrite <title> tag for better SEO
function seo_title() {
global $post, $page, $paged;
$sep = " | "; # Separator
$newtitle = get_bloginfo('name'); # Default
# Single page ########################################
if (is_single() || is_page()) {
$newtitle = single_post_title("", false); # default title
}
@robneu
robneu / wordpress-seo-keywords-bs.php
Created September 16, 2013 13:40
WordPress SEO without a plugin is complete crap. Let's break it down one function at a time.
<?php
function basic_wp_seo() {
global $page, $paged, $post;
$default_keywords = 'wordpress, plugins, themes, design, dev, development, security, htaccess, apache, php, sql, html, css, jquery, javascript, tutorials'; // customize
$output = '';
// description
$seo_desc = get_post_meta($post->ID, 'mm_seo_desc', true);
$description = get_bloginfo('description', 'display');
$pagedata = get_post($post->ID);
@MikeNGarrett
MikeNGarrett / wp-3-8-replace-open-sans
Last active January 10, 2018 14:39
WordPress 3.8 - replace admin Open Sans font with your own version
function replace_open_sans() {
// Kill the original style
wp_deregister_style('open-sans');
// Replace it with your own (just as an example, I included only the 300 weight)
wp_register_style( 'open-sans', 'http://fonts.googleapis.com/css?family=Open+Sans:300' );
wp_enqueue_style( 'open-sans');
}
add_action( 'wp_enqueue_scripts', 'replace_open_sans' );
// Thanks to @timkinnane
add_action( 'admin_enqueue_scripts', 'replace_open_sans' );
@Jeff2Ma
Jeff2Ma / Support PayPal GateWay in woocommerce.php
Last active August 28, 2022 12:07
Support PayPal GateWay in woocommerce【让woocommerce中文网关支持paypal并自动转换人民币美元转换】
<?php
//woocommerce中文网关支持paypal
// details at http://devework.com/support-paypal-gateway-in-woocommerce.html
//本函数解决的问题:贝宝不支持你的商铺货币。Gateway Disabled: PayPal does not support your store's currency.
add_filter( 'woocommerce_paypal_supported_currencies', 'enable_custom_currency' );
function enable_custom_currency($currency_array) {
$currency_array[] = 'CNY';
return $currency_array;
}
@davereese
davereese / RegisterCPT.php
Created March 12, 2015 20:25
Custom Post Type and ACF Example
<?php
// Register Custom Post Types
add_action('init', 'register_custom_posts_init');
function register_custom_posts_init() {
// Register Products
$products_labels = array(
'name' => 'Products',
'singular_name' => 'Product',
'menu_name' => 'Products'
@CaiJimmy
CaiJimmy / index.html
Last active April 29, 2024 08:43
Disqus点击加载
<button id="load-disqus" onclick="disqus.load();">
加载Disqus
</button>
<div id="disqus_thread"></div>
@SmartFinn
SmartFinn / dhcp-leases-to-dns.rsc
Last active December 28, 2025 03:20
MikroTik (RouterOS) script for automatically setting DNS records for clients when they obtain a DHCP lease
# MikroTik (RouterOS) script for automatically setting DNS records
# for clients when they obtain a DHCP lease.
#
# author SmartFinn <https://gist.github.com/SmartFinn>
:local dnsTTL "00:15:00";
:local token "$leaseServerName-$leaseActMAC";
# Normalize hostname (e.g. "-= My Phone =-" -> "My-Phone")
# - truncate length to 63 chars
@thie1210
thie1210 / apcupsd-mac-os-el-capitan-back-ups-pro.md
Last active January 26, 2025 13:38
Installing and configuring apcupsd for a APC Back-UPS Pro 1000 (BR1000G) on Mac OS X El Capitan (10.11)

Installation

$ brew install apcupsd

$ # Kernel extension installation
$ sudo cp -pR /usr/local/Cellar/apcupsd/3.14.13/Library/Extensions/ApcupsdDummy.kext /System/Library/Extensions/
$ sudo chown -R root:wheel /System/Library/Extensions/ApcupsdDummy.kext
$ sudo touch /System/Library/Extensions/
@CodeMyUI
CodeMyUI / Text underline hover effects.markdown
Created July 18, 2016 11:26
Text underline hover effects
@gireeshkbogu
gireeshkbogu / convert_GTF_to_BED12.sh
Last active February 23, 2026 00:58
How to convert GTF format into BED12 or BIGBED format?
# see below for UPDATES that include more shorter ways of conversions
# How to convert GTF format into BED12 format (Human-hg19)?
# How to convert GTF or BED format into BIGBED format?
# Why BIGBED (If GTF or BED file is very large to upload in UCSC, you can use trackHubs. However trackHubs do not accept either of the formats. Therefore you would need bigBed format)
# First, download UCSC scripts
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/gtfToGenePred
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/genePredToBed
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bedToBigBed