Skip to content

Instantly share code, notes, and snippets.

View ooooak's full-sized avatar
🏠
Working from home

Akshay ooooak

🏠
Working from home
View GitHub Profile
shpw swap images
cat /proc/swaps or
sudo swapon -s
https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps
@ooooak
ooooak / gist:7ef9edfb3142bb9ac59c
Created November 19, 2014 10:47
wordpress load ie only
function load_ie_files(){
global $is_IE;
if (!$is_IE) {
}
}
add_action('wp_enqueue_scripts', 'load_ie_files');
@ooooak
ooooak / gist:16325ea18b837b734c45
Last active August 29, 2015 14:09
untrack files on local repo
# reset to last commit
git reset --hard HEAD
# remove un-tracked files
git clean -f -d
# see changed files
git status --short
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
@ooooak
ooooak / gist:6ee19b5bedeabd206751
Last active August 29, 2015 14:10
terminal color
terminal color->
text: #00FF00
bg: #000000
@ooooak
ooooak / load.php
Last active August 29, 2015 14:10
[wordpress] plugin patch
<?php
if (!isset($GLOBALS['_scb_data'])):
$GLOBALS['_scb_data'] = array( 60, __FILE__, array(
'scbUtil', 'scbOptions', 'scbForms', 'scbTable',
'scbWidget', 'scbAdminPage', 'scbBoxesPage', 'scbPostMetabox',
'scbCron', 'scbHooks',
));
@ooooak
ooooak / gist:8737362671f529c851bb
Last active August 29, 2015 14:10
[wordpress] login user by user id
<?php
/**
* @param Mix $id will user id
* @param String $user_login
*/
function login_user($id, $user_login) {
wp_set_current_user( $id, $user_login);
wp_set_auth_cookie( $id );
do_action( 'wp_login', $user_login );
@ooooak
ooooak / gist:b8f3679da6621059bbac
Last active August 29, 2015 14:10
[wordpress] Generate unique user name
<?php
function generate_username( $username ){
return username_exists($username)
? admin_theme_user_manager::generate_username(
$username.mt_rand(1, 9)
.mt_rand(1, 9)
.mt_rand(1, 9)
.mt_rand(1, 9)
)
if (!wp_check_password($pass, $user->get('user_pass'), $user->get('id'))){
return false;
}
$user = wp_signon(array(
'user_login' => $login,
'user_password' => $pass,
));
if (is_wp_error($user)){
@ooooak
ooooak / gist:be84af6f4f3f76d5847e
Created December 5, 2014 10:37
change spam status
if (!function_exists('update_user_status')){
include(ABSPATH . "wp-admin/includes/ms.php");
}
if (!update_user_status($user_id, 'spam', $spam_value)){
return array(true, 'Unable to change spam status');
}