Skip to content

Instantly share code, notes, and snippets.

View ahgood's full-sized avatar

Guojun ahgood

  • Fullstack Developer
  • Halifax
View GitHub Profile
@SamanSh999
SamanSh999 / changebg.sh
Created January 18, 2017 10:40 — forked from Reza-Rg/changebg.sh
A shell script to set Bing Background as wallpaper automatically on both OSX and Linux (requires wget & jq)
#!/usr/bin/env bash
if [ "$(uname)" = "Darwin" ]; then
jq=/usr/local/bin/jq
wget=/usr/local/bin/wget
image_folder_path="/Users/$USER/Documents/Images/Bing/"
mkdir -p $image_folder_path
@seventhqueen
seventhqueen / enable-chinese-characters-usernames.php
Created December 8, 2016 11:07
Enable Chinese usernames in Wordpress registration
function sanitize_chinese_user( $username, $raw_username, $strict ) {
if ( $username != $raw_username ) {
$username = $raw_username;
}
$username = strip_tags( $username );
// Kill Chinese characters
$username = preg_replace( '|[^a-z0-9 _.\-@一-龥]|ui', '', $username );
// Consolidate contiguous whitespace
@kstover
kstover / nf-after-load.js
Created November 10, 2016 18:47
Ninja Forms Three - After a form has loaded
// Create a new object for custom validation of a custom field.
var nameSpaceController = Marionette.Object.extend( {
initialize: function() {
this.listenTo( nfRadio.channel( 'form' ), 'render:view', this.doCustomStuff );
},
doCustomStuff: function( view ) {
var formModel = view.model; // formModel will be a Backbone model with all of our form data.
var formID = formModel.get( 'id' ); // We can use .get( 'setting' ) get get any of our form settings.
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active September 27, 2025 02:50
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@lukecav
lukecav / remove-logout-link-wp-comment-form.php
Created October 7, 2016 21:28 — forked from renventura/remove-logout-link-wp-comment-form.php
Remove the "Logged in as {username}. Log Out?" link from the WordPress comment form.
@nishinoshake
nishinoshake / readme.md
Last active July 5, 2017 04:40
PostfixとProcmailで迷惑メールの振り分け

Procmailとは

メールの振り分けをしてくれるソフトウェア。
設定ファイルにルールを記載するとよきに計らってくれる。

インストール

yum install procmail

Postfixの設定

# procmailのパス調べる

which procmail

@tatemz
tatemz / docker-wpcli.sh
Last active December 18, 2020 06:59
A quick way to use one-off wp-cli commands with Docker. See Part 1: https://gist.github.com/tatemz/504383c921aa5898c49b82d4ee181362
#!/bin/bash
cd wordpress-site
cat >> docker-compose.yml <<EOL
my-wpcli:
image: tatemz/wp-cli
volumes_from:
- my-wp
links:
@tatemz
tatemz / docker-wordpress.sh
Last active April 14, 2025 11:18
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@pokka
pokka / wechat-browser-detect.js
Last active January 20, 2025 17:27 — forked from cary929/wechat-browser-detect.js
JavaScript 判断是否微信内置浏览器
// 使用 userAgent 判断是否微信内置浏览器
if( navigator.userAgent.toLowerCase().indexOf('micromessenger') > -1 || typeof navgator.wxuserAgent !== "undefined" ) {
return true;
}