Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / gist:2511d53ec9df2a19f750
Created December 22, 2014 19:07
Snippet for Hubspot
<div class="related-links">
<h3>Related Links</h3>
<ul>
<li><a href="http://cenduit.com">This is a Link Yay</a></li>
</ul>
</div>
@jdcauley
jdcauley / WP-gitignore
Last active August 29, 2015 14:11
gitignore
# --- Ignore core WP files, while allowing wp-content/ directory
wp-config.php
# --- Ignore globally
*wp-config.php
@jdcauley
jdcauley / salesforce.js
Last active August 29, 2015 14:10
json
{ attributes:
{ type: 'Attachment',
url: '/services/data/v31.0/sobjects/Attachment/xxxxxxxxx' },
Id: 'xxxxxxxxx',
IsDeleted: false,
ParentId: 'xxxxxxxxx',
Name: 'ocean copy.jpg',
IsPrivate: false,
ContentType: 'image/jpeg',
BodyLength: 143953,
@jdcauley
jdcauley / app.js
Created December 4, 2014 20:49
Simple Notifications
function notification(status, message, callback){
var target = document.getElementById('mc_embed_messages');
if(status === 500){
target.innerHTML = '<span class="error-title">ERROR:</span> ' + message;
target.className = "error";
callback();
}
if(status === 200){
@jdcauley
jdcauley / admin.js
Last active November 6, 2018 06:02
User Profile WP
jQuery(document).ready(function($){
var _custom_media = true,
_orig_send_attachment = wp.media.editor.send.attachment;
$('#upload_image_button').click(function(e) {
var send_attachment_bkp = wp.media.editor.send.attachment;
var button = $(this);
var id = button.attr('id').replace('_button','');
_custom_media = true;
@jdcauley
jdcauley / app.js
Created November 17, 2014 18:53
Match the secondar list scroll to main list
function articleMenuScroll(direction, target){
var liHeight = 0;
$('#sidebar-posts li').each(function(index) {
if($(this).attr('data-id') === target.attr('data-id')){
return false;
} else {
liHeight = liHeight + ($(this).height() + 20);
}
});
@jdcauley
jdcauley / sidebar.php
Created November 11, 2014 18:57
WP Related Posts
$tag_query = array();
if($tags){
$tag_ids = '';
foreach($tags as $tag){
print_r($tag->term_id);
$tag_ids .= ',' . $tag->term_id;
}
$tag_ids = substr($tag_ids, 1);
$tag_query = new WP_Query( array( 'tag__in' => array($tag_ids) ) );
$.getJSON( url, function( data ) {
var factSites = data.feed.entry;
for(var i = 0; i < factSites.length; i++ ){
var markerData = {
continent: factSites[i].gsx$continent.$t,
country: factSites[i].gsx$country.$t,
city: factSites[i].gsx$city.$t,
@jdcauley
jdcauley / sortedlist
Last active August 29, 2015 14:07
li Sort
function alphabatizeMenu(target){
var continent = document.getElementById('tab_' + target);
if(continent){
var listParent = document.getElementById(target + '-offices');
var listItems = continent.getElementsByClassName('in-' + target);
var listItemText = [];
for(var i = 0; i < listItems.length; i++){
listItemText.push({
country: listItems[i].textContent,
item: listItems[i]
@jdcauley
jdcauley / gist:b7f2f232277cb481ccc5
Created October 13, 2014 18:50
file permissions wp
chown www-data:www-data -R * # Let apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--