Skip to content

Instantly share code, notes, and snippets.

View alispx's full-sized avatar

ALI MAHFUD alispx

View GitHub Profile
@alispx
alispx / layers-widget-template.php
Last active August 29, 2015 14:21
Template Layers Widget
<?php
/**
* Template Widget
*
* This file is used to register and display the Layers - Your widget Name.
*
* @package Layers
* @since Layers 1.0
*/
@alispx
alispx / instagram-scrapper.php
Created June 30, 2015 02:02
Instagram scrapper
// based on https://gist.github.com/cosmocatalano/4544576
function scrape_instagram( $username, $slice = 9 ) {
$username = strtolower( $username );
if ( false === ( $instagram = get_transient( 'instagram-media-new-'.sanitize_title_with_dashes( $username ) ) ) ) {
$remote = wp_remote_get( 'http://instagram.com/'.trim( $username ) );
if ( is_wp_error( $remote ) )
<?php
/**
* Get all type posts
*
* @return void
* @author alispx
**/
function alispx_get_type_posts_data( $post_type = 'post' ) {
#!/bin/bash
find . -type d -iname .git | xargs rm -rf
find . -type d -iname .sass-cache | xargs rm -rf
find . -type f -iname .gitignore | xargs rm -rf
find . -type f -iname .DS_Store | xargs rm -rf
find . -type f -iname config.codekit | xargs rm -rf
find . -type f -iname screen.css.map | xargs rm -rf
find . -type f -iname rtl.css.map | xargs rm -rf
find . -type f -iname config.rb | xargs rm -rf
find . -type d -iname sass | xargs rm -rf
#!/bin/bash
ssh -T username@hostorip << EOSSH
cd /home/username/; ls -l;
wget -c http://example.com/file.tar.gz;
tar -zxvf file.tar.gz;
exit;
EOSSH
jQuery(document).ready(function($) {
$('ul').find('li').each(function () {
if ($.trim($(this).text()) == "") {
$(this).remove();
}
})
});
<?php
/**
* Constructor
*/
add_action( 'init', 'tax_image_init' );
function tax_image_init() {
$tk_taxonomies = array( 'authors', 'publisher' );
foreach ( $tk_taxonomies as $tk_taxonomy ) {
@alispx
alispx / convert-post-meta.php
Created December 27, 2015 09:50 — forked from ChaseWiseman/convert-post-meta.php
A function for converting existing WordPress meta keys to new values.
/**
* Convert existing meta keys to new meta keys.
*
* @since x.x.x
*
* @global object $wpdb The current database.
*
* @param string $existing_key The existing meta key.
* @param string $new_key The new meta key.
* @param bool $remove_existing Optional. Whether to remove the old meta entries after conversion.
<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/
esc_html__( ‘Some String’, ‘text-domain’ ); esc_html_e( ‘Some String’, ‘text-domain’ );
/**
add_action('add_meta_boxes', 'alispx_meta_boxes');
function alispx_meta_boxes() {
add_meta_box(
'alispx-meta-box',
__( 'Phone Model', THEMO_TEXT_DOMAIN ),
'alispx_meta_box_callback',
'page'
);
}