Skip to content

Instantly share code, notes, and snippets.

@karrikas
karrikas / build.xml
Last active June 15, 2017 17:44
Build file for deploy wordpress project from local to production server.
<?xml version="1.0" encoding="UTF-8"?>
<project name="wordpress" default="deploy">
<target name="deploy">
<propertyprompt propertyName="rsync.type" promptText="Deploy? (test or yes)" defaultValue="test" />
<if>
<equals arg1="${rsync.type}" arg2="yes" />
<then>
<exec command="rsync --exclude-from='rsync_exclude' -e 'ssh -p 333' --delete-after -razv . sshuser@host.com:/final/path" outputProperty="info" />
@karrikas
karrikas / url-finder
Created October 1, 2015 14:52
Find url from entire website
<?php
class urlfinder {
var $urls = array();
var $visited = array();
var $domain;
public function get ($url, $domain = '') {
if (in_array($url, $this->visited)) {
@karrikas
karrikas / .gitignore
Last active December 20, 2016 10:00
Gitignore for wordpress project
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
!build.xml
!build_rsync_exclude
# Ignore everything in the "wp-content" directory, except the "plugins" and "themes" directories.
wp-content/*
!wp-content/plugins/
@karrikas
karrikas / build.xml
Last active September 21, 2015 12:43
Custom task to clean wordpress serialized information in dump file
<project name="xxx" default="dist">
<target name="_init_wp_serialize">
<adhoc-task name="wp-serialize-clean"><![CDATA[
class Wp_Serialice_Update extends Task {
private $file;
function setFile($file) {
$this->file = $file;
}
@karrikas
karrikas / .vimrc
Last active September 18, 2015 21:10
Vim configuracion
" Vundle instalatu lehengo
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
@karrikas
karrikas / functions.php
Created September 17, 2015 12:53
Wordpress list hooked functions
<?php
function list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
} else {
@karrikas
karrikas / wordpress-force-404.php
Created September 17, 2015 10:22
Wodpress force 404
header("HTTP/1.0 404 Not Found - Archive Empty");
$wp_query->set_404();
require TEMPLATEPATH.'/404.php';
exit;