Skip to content

Instantly share code, notes, and snippets.

View kermitsxb's full-sized avatar
🤩
Learning new things

Stocki kermitsxb

🤩
Learning new things
View GitHub Profile
alert('fuck you')
@gerbenvandijk
gerbenvandijk / Mark parent navigation active when on custom post type single page
Last active January 1, 2024 21:22
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@graste
graste / datetime.php
Last active May 22, 2023 19:30
PHP DateTime class – parsing and formatting ISO8601 dates with or w/o fractions of a second
<?php
echo 'default locale: ' . \Locale::getDefault();
echo PHP_EOL;
echo 'default timezone: ' . \date_default_timezone_get();
echo PHP_EOL;
// see http://tools.ietf.org/html/rfc3339#section-5.8 for example datetimes
// bug report on missing fractions support: https://bugs.php.net/bug.php?id=51950
// feature request for fractions support in constructor: https://bugs.php.net/bug.php?id=49779
@sevir
sevir / log.php
Created January 31, 2015 23:12
CodeIgniter/Creamture Log Viewer
<?php
/**
* Enhaced Log viewer for CodeIgniter
* SeViR @2015
* based in old version of 2010
*/
class Viewer{
//Please for security set your external ip
private static $allow_ips = array(
'127.0.0.1',
@tymarbut
tymarbut / README.md
Last active March 21, 2024 04:45
Baofeng (or other radio) data TX/RX for Raspberry Pi

This flow (and associated circuits/hardware) is designed to allow Node-RED to pass messages via radio waves in the same way as it passes messages via MQTT, using commonly-available, inexpensive handheld radios and the Raspberry Pi. The flow has been tested using Baofeng, Wouxun, and Quansheng handheld ham radios. In short, the goal is to allow packet-like transmissions between Node-RED systems over miles, while keeping the hardware costs down (or free for those hams who have surplus Baofengs hanging around). This could be used for a backup to MQTT when the Wifi is unreliable, or simply as a long-distance and network-agnostic message channel.

Prerequisites: Software

First, we need PulseAudio to make and receive sounds with our USB soundcard:

sudo apt-get install pulseaudio -y
@rowanmanning
rowanmanning / README.md
Last active February 18, 2024 21:12
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/

[Linux Mint 17.2] Install MyCLI and grc

Install both grc and mycli

$ [sudo] apt-get install grc && \
> curl https://packagecloud.io/gpg.key | [sudo] apt-key add - && \
> [sudo] apt-get install -y apt-transport-https && \
> [sudo] sh -c \
@hmps
hmps / gist:3c58f2e75d2d64233c66344561347241
Last active February 20, 2024 11:51
TMUX config and keybindings

Key bindings

So ~/.tmux.conf overrides default key bindings for many action, to make them more reasonable, easy to recall and comforable to type.

Let's go through them.

If you are an iTerm2 user, third column describes the keybinding of similar "action" in iTerm2. It's possible to reuse very same keys you already get used to and tell iTerm2 to execute analogous tmux actions. See iTerm2 and tmux integration section below.