Skip to content

Instantly share code, notes, and snippets.

@jdcauley
jdcauley / app.less
Created September 5, 2014 13:21
css header
@import '_bootstrap';
@import '_variables';
/* ===================================
Utilities
=================================== */
.social{
list-style: none;
@jdcauley
jdcauley / Gulpfile.js
Created October 10, 2014 13:02
Sass Gulpfile.js
var gulp = require('gulp');
var compass = require('gulp-compass');
var watch = require('gulp-watch');
var minifyCSS = require('gulp-minify-css');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
gulp.task('scss', function(){
console.log('running scss');
@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--
@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]
$.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 / 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) ) );
@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 / 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 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 / 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,