Skip to content

Instantly share code, notes, and snippets.

Sub MyAdd(ByVal strTableName As String, ByRef arrData As Variant)
Dim Tbl As ListObject
Dim NewRow As ListRow
Set Tbl = Worksheets("Cart Conversion").ListObjects(strTableName)
Set NewRow = Tbl.ListRows.Add(AlwaysInsert:=True)
' Handle Arrays and Ranges
If TypeName(arrData) = "Range" Then
NewRow.Range = arrData.Value
@mynameispj
mynameispj / yourmodule.module
Last active August 29, 2015 13:56
Get Drupal 7 comment forms to display error messages on the original node's page
function yourmodule_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'comment_node_blog_post_form') {
$form['actions']['submit']['#value'] = 'Add Your Comment';
$form['#action'] = '?'. drupal_get_destination();
}
}
@mynameispj
mynameispj / MySQL
Created April 8, 2014 04:12
Drupal 7 - Turn on comments for all nodes in a content type via MySQL
UPDATE node SET comment = 2 WHERE type = 'foo'
UPDATE node_revision SET comment = 2 WHERE nid IN (SELECT nid FROM node WHERE type = 'foo')
//'foo' = the machine name of your content type
@mynameispj
mynameispj / affix.css.scss
Last active August 29, 2015 14:03
Bootstrap affix on smaller screens...
@media (max-width: 768px) {
.affix {
position: static;
}
}
@mynameispj
mynameispj / scripts.js
Created November 3, 2014 01:04
Wordpress: Remove image height & width on mobile devices with jQuery
/**
* jQuery.browser.mobile (http://detectmobilebrowser.com/)
*
* jQuery.browser.mobile will be true if the browser is a mobile device
*
**/
(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|
@mynameispj
mynameispj / drupal_6_updateCache
Created March 16, 2012 16:21
Drupal 6 custom module to update all site caches
function z_masterfit_ui_customized_menu() {
$items = array();
$items['admin/flush-cache'] = array(
'type' => MENU_NORMAL_ITEM,
'title' => t('Flush the cache'),
'description' => 'Flush all website caches to make sure it updates to relect '.
'your recent changes.',
'page callback' => 'flush_cache_custom_callback',
'access callback' => user_access('flush cache'),
@mynameispj
mynameispj / gist:2237482
Created March 29, 2012 13:36
jQuery snippet to remove and replace default form input text on click
$('form.form-search input').focus(function() {
if (this.value == this.defaultValue){
this.value = '';
}
if(this.value != this.defaultValue){
this.select();
}
});
$('form.form-search input').blur(function() {
if ($.trim(this.value) == ''){
@mynameispj
mynameispj / states-ul
Created April 2, 2012 19:29
<ul> of all 50 states
<ul>
<li>AL<li>
<li>AK<li>
<li>AZ<li>
<li>AR<li>
<li>CA<li>
<li>CO<li>
<li>CT<li>
<li>DE<li>
<li>DC<li>
@mynameispj
mynameispj / gist:2292158
Created April 3, 2012 13:50
JS - force page to reload
window.location.reload(true);
@mynameispj
mynameispj / gist:2296224
Created April 3, 2012 23:17
Google Maps API JS
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAOj_3CRyephdFtCbWh5OZ6eXa49zcJFHM&sensor=false"></script>
<div id="address" style="display:none;"><!--address for the map goes here-->8134 Country Village Drive Cordova, TN 38016</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
var geocoder;
function initialize() {
geocoder = new google.maps.Geocoder();