Skip to content

Instantly share code, notes, and snippets.

View whatnickcodes's full-sized avatar
😍

Nicholas Cerminara whatnickcodes

😍
View GitHub Profile
<!-- Button Hollow White -->
<a href="#" class="btn-hollow-white" style="padding: 15px 25px;line-height: 20px;">Text goes here</a>
<!-- Button Hollow Red -->
<a href="#" class="btn-hollow-red" style="width: auto; padding: 0;padding: 15px 25px;line-height: 20px;">Text goes here</a>
<!-- Take Action -->
<a href="#" class="btn-take-action" style=" padding: 15px 25px; line-height: 20px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600;">Text goes here</a>
<?php
add_action('pre_get_posts', function ($query) {
global $wp;
if (!is_admin() && $query->is_main_query()) :
if ($wp->request == '.custom-hidden-endpoint-wordpress-way-is-a-death-trap') {
header('Content-Type: application/json');
echo json_encode(array('hi' => 'mathias'));
exit;
endif;
@whatnickcodes
whatnickcodes / callback.js
Created February 23, 2015 17:22
callback
GoogleApi.geocodeAddress(vm.formData.address)
.success(function(data) {
// vm.processing = false;
if (data.status == 'ZERO_RESULTS') {
// Show Message
console.log('not good to goo');
} else if (data.status == 'OK' && data.results.length > 1) {
// Show message
console.log('too many results');
@whatnickcodes
whatnickcodes / title.php
Created February 23, 2015 16:39
WordPress better Get Title
<?php
/* Add to Functions.php */
function grab_title() {
if (is_page() || is_single())
{
return get_the_title();
}
elseif (is_archive() && !is_category() && !is_tag() && !is_author() && !is_tax())
@whatnickcodes
whatnickcodes / example.html
Last active August 29, 2015 14:14
CCL Background Image
<style>body.fancy main { background-image: url('http://example.com/my-image.jpg') !important; </style>
@whatnickcodes
whatnickcodes / thing.php
Created October 22, 2014 16:43
WordPress custom post types prev and next logic
<?php
$projects = array();
$loop = new WP_Query(array('post_type' => array('work'), 'posts_per_page' => -1, 'order' => 'ASC'));
$i = 1;
$current = FALSE;
$current_post_id = $post->ID;
while ($loop->have_posts()) : $loop->the_post();
$projects[$i]['title'] = get_field('grid_title');
$projects[$i]['url'] = get_permalink();
@whatnickcodes
whatnickcodes / Vagrantfile
Created October 20, 2014 04:22
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "mynewbox"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "mynewbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
cat /dev/null > ~/.bash_history && history -c && exit
vagrant package --output scotch.box
vagrant box add ubuntu64 package.box
vagrant init ubuntu64
@whatnickcodes
whatnickcodes / example.js
Created September 17, 2014 16:59
Cookie setting for DCCC
// Compressed from https://developer.mozilla.org/en-US/docs/Web/API/document.cookie
var docCookies={getItem:function(e){if(!e){return null}return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},setItem:function(e,t,n,r,i,s){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e)){return false}var o="";if(n){switch(n.constructor){case Number:o=n===Infinity?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:o="; expires="+n;break;case Date:o="; expires="+n.toUTCString();break}}document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+o+(i?"; domain="+i:"")+(r?"; path="+r:"")+(s?"; secure":"");return true},removeItem:function(e,t,n){if(!this.hasItem(e)){return false}document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(n?"; domain="+n:"")+(t?"; path="+t:"");return true},hasItem:function(e){if(!e){return false}return(new RegExp("(?:
$(function() {
fixedHeader();
});
$(window).scroll(function() {
fixedHeader();
});
$(window).resize(function() {