Skip to content

Instantly share code, notes, and snippets.

@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@shizhua
shizhua / category_add_form_fields.php
Last active July 19, 2022 03:23
Add custom field to Category and taxonomies
<?php
// Add the field to the Add New Category page
add_action( 'category_add_form_fields', 'pt_taxonomy_add_new_meta_field', 10, 2 );
function pt_taxonomy_add_new_meta_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="term_meta[cat_icon]"><?php _e( 'Font Awesome Icons', 'pt' ); ?></label>
<input type="text" name="term_meta[cat_icon]" id="term_meta[cat_icon]" value="">
@ms-studio
ms-studio / add-metabox-to-taxonomy.php
Created December 14, 2015 21:57
simple but complete example of adding metabox to taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// REGISTER TERM META
add_action( 'init', '___register_term_meta_text' );
function ___register_term_meta_text() {
@barchard
barchard / forge_ioncube_php.sh
Created May 18, 2018 00:37 — forked from mechawrench/forge_ioncube_php_71.sh
Laravel Forge IonCube 7.1 Installation Recipe
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar zxvf ioncube_loaders_lin_x86-64.tar.gz
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
PHP_EXT_DIR=$(php-config --extension-dir)
PHP_CONFD="/etc/php/${PHP_VERSION}/fpm/conf.d"
cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $PHP_EXT_DIR
echo "zend_extension = ${PHP_EXT_DIR}/ioncube_loader_lin_${PHP_VERSION}.so" > "${PHP_CONFD}/00-ioncube.ini"
PHP_CONFD="/etc/php/${PHP_VERSION}/cli/conf.d"
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
PHP_EXT_DIR=$(php-config --extension-dir)
@BenSampo
BenSampo / deploy.sh
Last active April 30, 2024 03:41
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@Ryanb58
Ryanb58 / install.md
Last active April 30, 2024 03:04
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@Efreak
Efreak / Calibre Server with nginx WebDAV.md
Last active December 2, 2022 20:40 — forked from luzfcb/CalibreServerOnLinux.md
Calibre Server on Linux (in progress)

This is for setting up an nginx virtual host with webdav access, as well as open directory access if you've got a reader that doesn't support OPDS, or as a backup in the case your server is misconfigured, inaccessible, javascript is disabled, etc.

setup an htpasswd file (this will only be used for webdav, not for calibre itself). You may run this command as many times as you like to add extra users.

mkdir -p /etc/nginx/auth
printf "$(please enter your username):$(openssl passwd $(read -p "Please enter your password")\n" >> /etc/nginx/auth/calibre-webdav-users.passwd

Use this config instead of the one in the main file

@michaelbutler
michaelbutler / Steam_Proton_Exe.md
Last active April 24, 2024 06:49
How to run another .exe in an existing proton wine prefix

Running games through Steam's Proton is great. But what if there is a secondary exe or configuration application bundled with the game? How can you launch it if Steam itself only launches the game?

Simply run this command in a terminal:

cd /path/to/steam/steamapps/compatdata/20920/pfx

STEAM_COMPAT_DATA_PATH="/path/to/steam/steamapps/compatdata/20920" WINEPREFIX=$PWD \
    "$HOME/.steam/root/steamapps/common/Proton 5.0/proton" run ./drive_c/path/to/custom_application.exe
@chrisjp
chrisjp / cloudflare_restore_ips.sh
Created October 13, 2023 15:59
A shell script to restore original visitor IPs to Apache/Nginx web servers behind Cloudflare's reverse proxy
#!/bin/bash
# Restore original visitor IPs to your logs
# https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/
# Conf file locations
CLOUDFLARE_NGINX="/etc/nginx/conf.d/real_ip.conf"
CLOUDFLARE_APACHE="/etc/apache2/conf-available/remoteip.conf"
# Download IP lists (txt files)
IPV4=`curl -s -L https://www.cloudflare.com/ips-v4`