Skip to content

Instantly share code, notes, and snippets.

View musamamasood's full-sized avatar
🎯
Focusing

Muhammad Usama Masood musamamasood

🎯
Focusing
View GitHub Profile
@musamamasood
musamamasood / gist:f71fe99071447f36f70468081dd742cb
Created September 16, 2016 18:39 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@musamamasood
musamamasood / transfer.php
Last active June 30, 2021 22:14
Transfer files to server with publicly accessible zip file.
<?PHP
/**
* Transfer Files Server to Server using PHP Copy and PHP ZipArchive
* @link https://glowLogix.com
*/
/* Source File URL */
$remote_file_url = 'http://example.com/filename.zip';
/* New file name and path for this file */
@musamamasood
musamamasood / style.css
Created September 30, 2016 02:37
Widget Style
/**
* 10.0 - Widgets
*/
#blog-sidebar .widget {
border-top: 4px solid #FECE00;
margin-bottom: 3.5em;
padding-top: 1.75em;
}
#blog-sidebar .widget-area > :last-child,
#blog-sidebar .widget > :last-child {
@musamamasood
musamamasood / bash.sh
Created October 16, 2016 10:40
Scrapper in Mac OX
If you ever need to download an entire Web site, perhaps for off-line viewing, wget can do the
job—for example:
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
@musamamasood
musamamasood / functions.php
Last active December 8, 2016 14:39
Helper Functions
/**
* The main logging function
*
* @uses error_log
* @param string $type type of the error. e.g: debug, error, info
* @param string $msg
*/
public static function log( $type = '', $msg = '' ) {
if ( WP_DEBUG == true ) {
$msg = sprintf( "[%s][%s] %s\n", date( 'd.m.Y h:i:s' ), $type, $msg );
@musamamasood
musamamasood / functions.php
Last active September 28, 2018 04:35
Shortcode to fetch post by post_type
// create shortcode to list all clothes which come in blue
function statesmen_news_shortcode( $atts ) {
$html = '';
// Attributes
$atts = shortcode_atts(
array(
'post_per_page' => '2',
'post_type' => 'post',
'id' => false
),
@musamamasood
musamamasood / emtysearch.js
Created December 7, 2016 03:39
jQuery plugin to prevent the empty search.
/**
* Stop empty searches
*
* @author Thomas Scholz http://toscho.de
* @param $ jQuery object
* @return bool|object
*/
(function( $ ) {
$.fn.preventEmptySubmit = function( options ) {
var settings = {
@musamamasood
musamamasood / wordpress_export-post-data.php
Created January 4, 2017 18:02 — forked from robinnorth/wordpress_export-post-data.php
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@musamamasood
musamamasood / function.js
Created January 13, 2017 20:30
Smooth Scrolling
// JavaScript Document
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
@musamamasood
musamamasood / r-debug.php
Created January 19, 2017 21:26 — forked from Rarst/r-debug.php
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: http://www.rarst.net/
License: MIT
*/
/**