Skip to content

Instantly share code, notes, and snippets.

View chrisdigital's full-sized avatar

Chris Carvey chrisdigital

View GitHub Profile
@chrisdigital
chrisdigital / deactivate-links-onclicks
Created July 13, 2012 23:34
Deactivate all links and remove onclick events with JQuery
@chrisdigital
chrisdigital / study-stumuli-css
Created July 13, 2012 23:48
CSS styles for study stimuli
body {
background:#fff;
}
.base-wrapper{
position:absolute;
z-index:10;
}
.content-wrapper {
@chrisdigital
chrisdigital / unix-find-string-then-move
Created July 15, 2012 18:59
Find files, by string in file names, in current directory, then move the files to another directory you've already created - bash command
sudo find . -name "string-in-filename-goes-here" -exec mv {} ~/full/destination/path/goes/here/in/your/user/folder \;
@chrisdigital
chrisdigital / sticky-element
Created July 16, 2012 16:39
This is modified code to work with mootools to use variables in the sticky element code and give flexibility to the selector being targeted.
// Scrolling sidebar for your website
// Downloaded from Marcofolio.net
// Read the full article: http://www.marcofolio.net/webdesign/create_a_sticky_sidebar_or_box.html
// This has a mootools.js dependency
// Modified by Chris Carvey Eyetrackshop, Inc.
window.onscroll = function()
{
///////////// Variables ///////////////
//Change selector and these numbers....
@chrisdigital
chrisdigital / Java Parameters
Created September 3, 2012 23:10
How to turn java on in your demo study
p = private('_params'); p.skip_java=false; p.skip_webcam_setup=false;
@chrisdigital
chrisdigital / Wordpress global find and replace in SQL
Last active October 11, 2015 14:48
Find and replace string in MYPHPAdmin in Wordpress SQL tables
Wordpress global find and replace in SQL
//Source: Global Find and Replace In Wordpress using MySQL | Barry Wise NJ SEO and Marketing Consultant
//http://www.barrywise.com/2009/02/global-find-and-replace-in-wordpress-using-mysql/
//http://stackoverflow.com/questions/7548964/sql-find-and-replace-text
//http://stackoverflow.com/questions/421227/sql-to-search-and-replace-in-mysql
//http://tdot-blog.com/wordpress/6-simple-steps-to-change-your-table-prefix-in-wordpress
UPDATE wp_posts SET post_content = REPLACE(post_content, 'staging.server.com', 'www.productionserver.com');
UPDATE [your_table_name] SET [your_table_field] = REPLACE([your_table_field], '[string_to_find]'
@chrisdigital
chrisdigital / Custom WP_query with custom post type, taxonomy and tag filtering
Created October 13, 2012 19:18
How to do a custom wp_query in wordpress with a custom post type , taxonomy and tags
```php
<?php
$args1 = array(
//choose what post type you want to pull from
'post_type' => array( 'news' ),
//speed up query by only grabbing published items
'post_status' => 'publish',
//drill down into postype with a specific taxonomy via a tax_query
'tax_query' => array(
@chrisdigital
chrisdigital / WP_query a custom posttype
Created October 14, 2012 21:03
Using wp_query to pull all entries under a custom post type
<ul> <?php
$args3 = array(
'post_type' => array( 'investigators' ), //set post type
'post_status' => 'publish', // only pull published
'field' => 'slug', //searching on slug field
'orberby' => 'name', //order by name *ignored if using custom order by plugin, set in admin*
'order' => 'DESC', //in descending order
'posts_per_page'=> '-1', //show all
//- - - - - - - - - - - - -
@chrisdigital
chrisdigital / PHP Date converter
Last active September 28, 2017 15:14
Little date function to convert XX/XX/XXXX into verbose date (e.g. "January 11, 2015")
```Php
function dateConvert($x_date){
$x_date = explode('/', $x_date, 4);
$x_months = array('','January','Febuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$x_month = intval($x_date[0]);
$x_day = intval($x_date[1]);
$x_year = $x_date[2];
return ($x_months[$x_month]." ".$x_day. ", ".$x_year);
}```
@chrisdigital
chrisdigital / grab_image_description_pinterest
Last active December 12, 2015 07:58
Grab image description for Pinterest. Extending functionality of "Pinterest Image Pin" Wordpress plugin... http://wordpress.org/extend/plugins/pinterest-image-pin/
/* Now wrapped in an if statement, checking for information to tag onto url even exists in current dom.
It also now encodes parentheses.
It was failing silently on some pages and wasn't sure why but it's fixed now.
I think the pinterest plugin uses multiple links and so I'm only targeting the .pin-it-button class link specfcally now.
I also chained a bunch of .txt stripping (.replace()) events together */
if(jQuery("div.specifications").length > 0){
//target the anchor/image link in the selector we're focused on...
var pinTarget = jQuery(".sdjpip_linkbox a.pin-it-button");