Skip to content

Instantly share code, notes, and snippets.

View itsmikita's full-sized avatar
🤡
Psyborg

It's Mikita itsmikita

🤡
Psyborg
View GitHub Profile
@itsmikita
itsmikita / custom-post-status-query.php
Last active August 29, 2015 14:05
WordPress: Query custom post_status without registering it first
<?php
add_action( 'pre_get_posts', '_custom_post_status_query' );
/**
* As of WordPress API for custom post statuses is still in developement.
* This method is a workaround to allow you to query posts by custom post
* status, without registering it with register_post_status();
*
* @param $query
@itsmikita
itsmikita / gist:09a6a58268b56e2f0762
Last active August 29, 2015 14:14
Changing WordPress database table prefix
After renaming table names:
1.
UPDATE {$new_prefix}options SET option_name = "{$new_prefix}user_roles" WHERE option_name = "{$old_prefix}user_roles";
2.
UPDATE {$new_prefix}usermeta SET meta_key = "{$new_prefix}capabilities" WHERE meta_key = "{$old_prefix}capabilities";
3.
UPDATE {$new_prefix}usermeta SET meta_key = "{$new_prefix}user_level" WHERE meta_key = "{$old_prefix}user_level";
@itsmikita
itsmikita / gist:d2566516a4a5310d7447
Last active August 29, 2015 14:26 — forked from morganwilde/gist:5574439
CATransform3D matrix with values explained
CATransform3D transformation = CATransform3DIdentity;
// x line
transformation.m11 = 1; // 20% less wide wall
transformation.m12 = 0; //-1 / 10.0; // skews left up, right down if >0
transformation.m13 = 0; // extends sideways for a short time
transformation.m14 = 0;// // 1 / 5000 = left side towards viewer, right side away from viewer
// y line
transformation.m21 = 0; //-1 / 2.0; // skews bottom left, top right if <0
transformation.m22 = 1; // .8 - 20% less tall
transformation.m23 = 0; // extends upward for a short time
@itsmikita
itsmikita / c.js
Last active September 3, 2015 14:19
Console (Anonymous) Chat with encryption
/**
* This script requires jQuery to be included.
* TODO: Fix non-jQuery or insert jQuery.
*
* It also encrypts messages with your key so that only
* you and people you shared the key via other medias like
* Facebook or phone can read the messages.
*/
// Help (:
@itsmikita
itsmikita / wp_change_domain.sql
Last active October 15, 2015 10:04
WordPress: Change domain and update all links MySQL procedure
--
-- Change domain and update all links
--
-- @param prefix - Table prefix
-- @param old - Old URL including http://, used to search for links in posts, etc.
-- @param new - The new URL including http://
--
SET @prefix = 'wp_';
SET @old = 'http://';
SET @new = 'http://';
@itsmikita
itsmikita / vh.sh
Last active January 19, 2016 22:10
#!/bin/sh
#
# Local virtual host manager script for Mac (nginx edit)
#
# How to install:
# 1. Save this script somewhere on your disk (/var/www)
# 2. Set $user, $servers and $document_root
# 3. Create symbolic link: ln -s /path/to/vh.sh /usr/local/bin/vh
# 4. Run 'vh -h' for instructions
#
@itsmikita
itsmikita / uninstall-node-mac.txt
Last active November 28, 2017 17:12
Completely uninstall Node.js on Mac
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/share/man/man1/node.1
@itsmikita
itsmikita / autoload.php
Created November 28, 2017 18:21
PSR-4 compliant autoloader for PHP7+
<?php
/**
* PSR-4 compliant autoloader, updated for PHP7+
*
* @param $class
*/
spl_autoload_register( function( $class ) {
require "vendor/autoload.php";
if( defined( 'NAMESPACE_PREFIX' ) ) {
@itsmikita
itsmikita / hhvm.ini
Created May 22, 2018 09:09
Local development with PHP and Proxygen on MacOS
; Disable <?hh
hhvm.hack.lang.look_for_typechecker = false
; Enable all PHP7 features
hhvm.php7.all = true
; Disable caching for static files
hhvm.server.expires_default = 1
; Make errors pointing to index.php
@itsmikita
itsmikita / cookie.js
Created May 22, 2018 11:00
JavaScript Cookies Wrapper