Skip to content

Instantly share code, notes, and snippets.

Focusing (kinda)

Rahil Wazir rahilwazir

Focusing (kinda)
Block or report user

Report or block rahilwazir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rahilwazir / mybb_attachments.rb
Last active Mar 19, 2020
MyBB to Discourse with attachment
View mybb_attachments.rb
# frozen_string_literal: true
require "mysql2"
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
# Before running this script, paste these lines into your shell,
# then use arrow keys to edit the values
export DB_HOST="localhost"
export DB_NAME="mybb"
rahilwazir /
Last active Apr 13, 2019
Git bare repo for deployments

Create a bare repo

> cd /some/path
> git init --bare myproject
> touch hooks/post-receive
> chmod +x hooks/post-receive
> vi hooks/post-receive
rahilwazir / wp-admin-add-posts-state.php
Created Apr 10, 2019 — forked from martijn94/wp-admin-add-posts-state.php
Snippet to add post state to a WordPress page
View wp-admin-add-posts-state.php
// Add post state to the projects page
add_filter( 'display_post_states', 'ecs_add_post_state', 10, 2 );
function ecs_add_post_state( $post_states, $post ) {
rahilwazir / focused-line.user.js
Created Nov 18, 2017
Focused Line for readers
View focused-line.user.js
(() => {
'use strict';
const height = 20;
const body = document.querySelector('body');
const focusedLine = document.createElement('div');
focusedLine.setAttribute('id', 'focused-line');
body.appendChild(focusedLine); = `position: absolute; width: 100%; background-color: rgba(230, 228, 63, 0.5); height: ${height}px; z-index: -1; display: none;`;
rahilwazir /
Last active Sep 14, 2017
Repeater Field in WordPress

Repeater Field in WordPress


Inject the following script to your PHP file

function my_enqueue_scripts() {
    wp_enqueue_script( 'phq', '/your/path/to/script.js', [ 'jquery', 'underscore', 'wp-util' ], '1.0', true );
rahilwazir /
Created Aug 18, 2017
.gitignore every thing execpt

Ignore everything

rahilwazir /
Last active Oct 1, 2018
Change upload directory, async upload, handle upload in WordPress

Change upload directory

// Grabbed from edd plugin
function set_upload_dir() {

	// Override the year / month being based on the post publication date, if year/month organization is enabled
	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
		// Generate the yearly and monthly dirs
		$time = current_time( 'mysql' );
rahilwazir /
Last active Apr 2, 2017
Error for keyboard Event
*** Error in `./event': free(): invalid size: 0x0000000001d43ab0 ***
======= Backtrace: =========

Full version:

$ scp -i ~/.ssh/id_rsa /path/to/ user@

Short version:

Put this in your ~/.bashrc or ~/.zshrc

rahilwazir /
Last active Mar 15, 2017 — forked from eyecatchup/
Bash script to install the latest Git version on CentOS 6.x.
#!/usr/bin/env bash
# Install the latest version of git on CentOS 6.x
# Install Required Packages
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install gcc perl-ExtUtils-MakeMaker
# Uninstall old Git RPM
sudo yum remove git
You can’t perform that action at this time.