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
@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
*
@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 / 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 gabe@fijiwebdesign.com
* @url http://www.fijiwebdesign.com/
* @license http://creativecommons.org/licenses/by-sa/3.0/us/
* @version $Id$
@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 / .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 / 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 / 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
*/
<?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 / auto-featured-image-wordpress.php
Created March 3, 2013 08:17
Here’s a quick snippet of code you can throw into your functions.php file that will your theme automatically set it to the first available image. Note, you can always go and set another image as the featured image if you want to. It checks to see if a featured image exists and if it doesn’t, picks the first one. Snippet from http://wpforce.com/a…
@vyatri
vyatri / README.md
Last active December 20, 2015 07:38
Twitter titanium oauth javascript to login, logout, tweet, and post photo to twitter

For those who got twitter authentication error:

in your app setting in dev.twitter.com , make sure you fill up callback_url field. Even though it's just a placeholder. Just to verify that you are using browser type app. Also tick "Allow this application to be used to Sign in with Twitter" checkbox. And make sure you have Access_Token generated on "Details" tab

original script ---> https://gist.github.com/rampicos/4320296

how to use ---> http://shareourideas.com/2012/12/18/linkedin-connect-for-appcelerator-titanium/

I modified the original script to be able to work on twitter v1.1 and PIN-based authentication.