Skip to content

Instantly share code, notes, and snippets.

View mostafasoufi's full-sized avatar
🍬

Mostafa Soufi mostafasoufi

🍬
View GitHub Profile
@reaneyk
reaneyk / gist:6604607
Created September 18, 2013 04:39
Example PHP Interface class
<?php
//Define a new Interface for all 'shapes' to inherit
interface Shape {
//Define the methods required for classes to implement
public function getColor();
public function setColor($color);
@chrisdigital
chrisdigital / Frontend user profile in WordPress
Created May 6, 2013 13:27
Setting up a editable user profile in WordPress on the frontend.
//How to edit a user profile on the front end?
//http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end
//Forcing nickname as display_name in custom edit profile template
//http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template
///////
<?php
@thefuxia
thefuxia / plugin-class-demo.php
Last active April 11, 2024 13:50
Plugin Class Demo
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Fuxia Scholz
* License: GPL
* Text Domain: plugin_unique_name
* Domain Path: /languages
@markjaquith
markjaquith / gist:2628225
Last active March 29, 2023 23:30
Script to sync WordPress SVN to GitHub
#!/bin/bash
# cd into the directory
cd ~/gitsync/github-wordpress-sync/;
# Make sure we are not already running
if [ -f .sync-running ];then
if test ! `find ".sync-running" -mmin +10`;then
# Currently running, but not stuck
exit 1;
fi
fi;
@cballou
cballou / get-ip-address-optimized.php
Created March 26, 2012 00:51
PHP - Advanced Method to Retrieve Client IP Address
<?php
function get_ip_address() {
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
// attempt to validate IP
if (validate_ip($ip)) {
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@scribu
scribu / backtrace-errors.php
Created October 14, 2010 07:25
Backtrace Errors
<?php
// Forked from: http://stackoverflow.com/questions/1159216/how-can-i-get-php-to-produce-a-backtrace-upon-errors/1159235#1159235
function process_error_backtrace($errno, $errstr, $errfile, $errline) {
if(!(error_reporting() & $errno))
return;
switch($errno) {
case E_WARNING :
case E_USER_WARNING :
case E_STRICT :
@cs278
cs278 / is_serialized.php
Created October 23, 2009 18:25
PHP is_serialized() function.
<?php
/**
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
/**
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 7, 2024 01:38
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶