Skip to content

Instantly share code, notes, and snippets.

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

Emran Ahmed EmranAhmed

🏠
Working from home
View GitHub Profile
<?php
/*
* Plugin Name: Commercial Client
* Plugin URI: http://pento.net/
* Description: A sample client plugin for showing updates for non-WordPress.org plugins
* Author: pento
* Version: 0.1
* Author URI: http://pento.net/
* License: GPL2+
*/
#! /bin/sh
#
# whatthecommit - Random commit message generator
#
# Show random commit message from http://whatthecommit.com/.
#
# Seungwon Jeong <seungwon0@gmail.com>
#
# Copyright 2011 by Seungwon Jeong
@EmranAhmed
EmranAhmed / gist:8023471
Last active December 31, 2015 17:59
WordPress Infinit Scroll
<?php
/**
* Infinite Scroll on the Homepage
*
* Display posts until the end of time
*
* @package WordPress
* @subpackage Lossip
* @since Lossip 1.0
*/
alias php53='brew unlink php53 > /dev/null; brew unlink php54 > /dev/null; brew unlink php55 > /dev/null; brew link php53 > /dev/null; ln -sf /usr/local/Cellar/php53/5.3.26/libexec/apache2/libphp5.so /Users/admin/.phpenv/libphp5.so; ln -sf /usr/local/Cellar/php54/5.3.26/bin /Users/admin/.phpenv/bin; sudo apachectl restart; echo "PHP 5.3 Enabled";'
alias php54='brew unlink php53 > /dev/null; brew unlink php54 > /dev/null; brew unlink php55 > /dev/null; brew link php54 > /dev/null; ln -sf /usr/local/Cellar/php54/5.4.19/libexec/apache2/libphp5.so /Users/admin/.phpenv/libphp5.so; ln -sf /usr/local/Cellar/php54/5.4.19/bin /Users/admin/.phpenv/bin; sudo apachectl restart; echo "PHP 5.4 Enabled";'
alias php55='brew unlink php53 > /dev/null; brew unlink php54 > /dev/null; brew unlink php55 > /dev/null; brew link php55 > /dev/null; ln -sf /usr/local/Cellar/php55/5.5.3/libexec/apache2/libphp5.so /Users/admin/.phpenv/libphp5.so; ln -sf /usr/local/Cellar/php54/5.5.3/bin /Users/admin/.phpenv/bin; sudo apachectl restart; e
# LESS compiler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} ^(.*)\.css
RewriteCond %1.less -f
RewriteRule ^(.*)\.css lessphp/less.php?f=$1.less
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@EmranAhmed
EmranAhmed / style.css
Last active March 21, 2024 13:34 — forked from luetkemj/style.css
WordPress Default Style.css file styling
/* =============================================================================
WordPress WYSIWYG Editor Styles
========================================================================== */
.entry-content img {
margin: 0 0 1.5em 0;
max-width: 100%;
height: auto;
}
.alignleft, img.alignleft {
@EmranAhmed
EmranAhmed / .bash_profile
Last active October 9, 2016 19:24 — forked from monkeymonk/.bash_profile
Bash Profile Long, bash example, zsh zshell, zshrc
# BASH Configuration and Aliases
# source: http://natelandau.com/my-mac-osx-bash_profile/
# source: https://github.com/mathiasbynens/dotfiles
# Sections:
# 0. Execute Only Once (if you want)
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
@EmranAhmed
EmranAhmed / functions.php
Last active February 19, 2016 13:48 — forked from hasinhayder/functions.php
wp rewrite endpoint, edit url redirect
<?php
function init_url_rewrite_rule(){
add_rewrite_endpoint( 'edit',EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
if(get_option("EDIT_REWRITE_RULE")!=1){
flush_rewrite_rules();
update_option("EDIT_REWRITE_RULE",1);
}
}
function redirect_edit_url(){
<?php
#!/usr/bin/env php
//usage: php envato-screenshots-downloader.php /path/to/save/screenshots http://url/to/screenshots/page
set_time_limit(0);
$dir = $argv[1];
$source = $argv[2];
print_r($argv);
mkdir ($dir);
$src = file_get_contents($source);
$pattern = '/src="(https:\/\/0.s3[a-zA-Z0-9_\-\.\/%]+)"/i';