Skip to content

Instantly share code, notes, and snippets.

View vyatri's full-sized avatar
:electron:
work remotely from anywhere

Juanita Vyatri vyatri

:electron:
work remotely from anywhere
View GitHub Profile
<?php
register_post_type('video', array( 'label' => 'Video','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => true,'rewrite' => array('slug' => 'video'),'query_var' => true,'has_archive' => true,'exclude_from_search' => false,'supports' => array('title','custom-fields','author',),'labels' => array (
'name' => 'Video',
'singular_name' => 'Video',
'menu_name' => 'Video',
'add_new' => 'Add Video',
'add_new_item' => 'Add New Video',
'edit' => 'Edit',
'edit_item' => 'Edit Video',
'new_item' => 'New Video',
@vyatri
vyatri / karma_helpers_for_wp.php
Last active December 14, 2015 06:48
Collection of functions to add karma functionality to your wordpress. So when a post is being voted up, the karma of the author will be up. Just like reddit. This is very basic. Fell free to use and modify.
<?php
/*
to begin, please create a table named [prefix]votelog e.g. wp_votelog
with the following three fields:
id : auto_increment, BIGINT, primary_key
voter_id: BIGINT
post_name: TEXT
*/
@vyatri
vyatri / album_wordpress.php
Last active December 14, 2015 06:39
Fat-free script to add Album functionality to your wordpress media library. The idea is to register a new taxonomy named 'album'. Simply paste album_wordpress.php script to your functions.php in your theme folder, or include this album_wordpress.php in functions.php. This is very basic. Fell free to use and modify.
<?php
/* paste this to functions.php or include */
register_taxonomy('album','attachment',
array(
'hierarchical' => true,
'label' => 'Albums',
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => 'fix_album_count',
@vyatri
vyatri / .htaccess
Created February 23, 2013 04:31
A .htaccess script to redirect any uri to maintenance.html . Useful to put the whole site to maintenance mode. You can still work on subdomain.
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_HOST} !^888\.888\.888\.888
RewriteRule $ /maintenance.html [R=302,L]
@vyatri
vyatri / bcrypt.php
Created August 25, 2011 08:50 — forked from rk/bcrypt.php
Simple bcrypt object to wrap crypt() with.
<?php
// Originally by Andrew Moore
// Src: http://stackoverflow.com/questions/4795385/how-do-you-use-bcrypt-for-hashing-passwords-in-php/6337021#6337021
//
// Heavily modified by Robert Kosek, from data at php.net/crypt
class Bcrypt {
private $rounds;
private $prefix;
@vyatri
vyatri / MimeMailParser.class.php
Created April 24, 2011 09:06
This class allows you to receive and parse email in PHP efficiently and effortlessly.
<?php
require_once('attachment.class.php');
/**
* Fast Mime Mail parser Class using PHP's MailParse Extension
* @author [email protected]
* @url http://www.fijiwebdesign.com/
* @license http://creativecommons.org/licenses/by-sa/3.0/us/
* @version $Id$
@vyatri
vyatri / web-zoomer.html
Created February 20, 2011 04:13
javascript zoom in zoom out button with jQuery and CSS3
<a href="javascript:void(0)" onclick="enlargex()" id="zoomtab">+ Enlarge</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
function enlargex(){
if ($('body').css('transform') == 'scale(1.2)') {
$('body').css('transform','scale(1)');
$('body').css('-webkit-transform','scale(1)');
$('body').css('-webkit-transform-origin','0 0');
$('body').css('-moz-transform','scale(1)');
@vyatri
vyatri / SimpleImage.php
Created February 2, 2011 12:59
Simple image resizer class
<?php
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Modified by: Juanita Vyatri (@vyatri)
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Last modified: 08/11/10
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*