Skip to content

Instantly share code, notes, and snippets.

View rachelbaker's full-sized avatar

Rachel Baker rachelbaker

View GitHub Profile
<?php
/**
* Simple FTP Class
*
* @package SFTP
* @name SFTP
* @version 1.0
* @author Shay Anderson 05.11
* @link shayanderson.com
* @license http://www.gnu.org/licenses/gpl.html GPL License
@rachelbaker
rachelbaker / wp_csv_import.php
Created November 26, 2012 17:36
WordPress CSV importer upload form
<h3><?php echo __('Upload CSV'); ?></h3>
<form action="" method="post" enctype="multipart/form-data">
<tr>
<td width="20%"><?php echo __('Select file'); ?></td>
<td width="80%"><input type="file" name="file" id="file"/></td>
</tr>
<tr>
@rachelbaker
rachelbaker / wp-custom-title-cpt-screen.php
Created February 7, 2012 03:48
WordPress Custom Title for Custom Post Type Screen
<?php
/**
* TODO: Replace cptname with name of custom post type
* TODO: Replace Screen Title Text Here with the content for the title box
*/
function custom_cptname_title( $title ){
$screen = get_current_screen();
if ( 'cptname' == $screen->post_type ) {
$title = 'Screen Title Text Here';
@rachelbaker
rachelbaker / display-latest-twitter-tweets.php
Created January 12, 2012 21:59
Display Latest Tweets Function - uses curl to fetch json timeline
// replace $username= with correct username
function rb_latest_tweet($username = 'rachelbaker', $include_date = true){
$twitter_feed_url = "https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=0&screen_name=$username&count=3"; // will show 3 most recent tweets, can change value if needed //
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $twitter_feed_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$alltweets = curl_exec($ch);
@rachelbaker
rachelbaker / wp_tax_breadcrumbs.php
Created October 3, 2012 02:47
wordpress taxonomy breadcrumb with taxonomy hierarchy
} else if ( is_tax() ) {
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
// Create a list of all the term's parents
$parent = $term->parent;
while ( $parent ):
$parents[] = $parent;
$new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) );
$parent = $new_parent->parent;
endwhile;
@rachelbaker
rachelbaker / install-yeoman-osx.md
Last active October 4, 2019 21:33
Instructions for installing Node NPM and Yeoman on OSX
@rachelbaker
rachelbaker / copyr.php
Created September 2, 2012 22:30
PHP method to copy a single file or recursively copy an entire directory
/**
* Copy a single file or recursively copy a directory along with all contents
* @param string $source Source path
* @param string $dest Destination path
* @return bool Returns TRUE on success, FALSE on failure
*/
function copyr($source, $dest)
{
// if only one file
if (is_file($source)) {
@rachelbaker
rachelbaker / object-storage.js
Created August 6, 2013 02:00
Extending Local Storage to save and get Objects
/**
* Extending the Local Storage Object to allow saving of objects.
*
* @param int|string key object key
* @param int|string value object value
* @return bool true|false
*/
Storage.prototype.setObject = function(key, value) {
this.setItem(key, JSON.stringify(value));
};
@rachelbaker
rachelbaker / baseline-css
Created October 28, 2011 18:21
Baseline CSS: Graph paper like background for easier alignment of elements
html {
font-size: 93.8%;
background-color: #f1f2f3;
background-image:
-webkit-linear-gradient(0deg, transparent .05em, rgba(0,0,0,.05) .05em, rgba(0,0,0,.05) .125000em, transparent .125000em),
-webkit-linear-gradient(rgba(0,0,0,.05) .062500em, transparent .062500em);
background-image:
-moz-linear-gradient(0deg, transparent .05em, rgba(0,0,0,.05) .05em, rgba(0,0,0,.05) .125000em, transparent .125000em),
-moz-linear-gradient(rgba(0,0,0,.05) .062500em, transparent .062500em);
background-image:
@rachelbaker
rachelbaker / install-handlebars.md
Created May 29, 2013 13:58
Instructions for installing Node NPM and Handlebars on OSX