Skip to content

Instantly share code, notes, and snippets.

Jake Bellacera jakebellacera

Block or report user

Report or block jakebellacera

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jakebellacera
jakebellacera / ICS.php
Last active Sep 17, 2019
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
View ICS.php
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@jakebellacera
jakebellacera / gmail-fluidapp-userscript.js
Last active Sep 16, 2019
An updated Fluidapp Userscript for Gmail
View gmail-fluidapp-userscript.js
// use for patterns:
// *gmail.com*
// *mail.google.com*
// *google.com*mail*
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 15000);
function updateDockBadge() {
@jakebellacera
jakebellacera / mamp-mysql2-rbenv.md
Created Aug 22, 2012
Instructions on how to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv
View mamp-mysql2-rbenv.md

How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

Let's say you're a web developer who happens to work with both MAMP and Ruby when building different types of websites. Let's say you also like to keep your MySQL stuff in one place and don't like having to juggle both a local MySQL install as well as a MAMP MySQL install. Well, you can indeed connect your ruby apps to MAMP's MySQL. Here's a tutorial on how to do it.

Important! Before you do anything, download and install MAMP. MAMP Pro will work as well. At the time of this writing, MAMP 2.1.1 is the latest.

First, install Ruby via rbenv

  1. Install homebrew
  2. Install rbenv: brew install rbenv, follow any instructions homebrew gives you after the installation is complete.
@jakebellacera
jakebellacera / bootstrap-4-menu-wordpress-filters.md
Last active Aug 8, 2019
Bootstrap 4 menus in WordPress via filters. No walker needed!
View bootstrap-4-menu-wordpress-filters.md

Bootstrap 4 menus in WordPress with filters

No walker needed!

This snippet allows you to create Bootstrap 4 menus without the use of a Walker. Instead, we're using filters to leverage WordPress core functionality as much as possible. Basically, all you need to do is this and you're done:

<nav class="navbar navbar-expand-lg fixed-top">
  <div class="container">
    <a class="navbar-brand" href="<?php echo home_url(); ?>">
@jakebellacera
jakebellacera / hubspot-adwords-gclid-tracking.js
Last active Jul 23, 2019
Simple HubSpot gclid tracking code integration
View hubspot-adwords-gclid-tracking.js
// The script below will ensure that gclid parameters are associated with
// contacts in HubSpot.
//
// A few things are required before this script will work:
//
// * You will need to have the HubSpot tracking code installed on the page. A
// few modifications will be required if you don't have the tracking code
// installed. Additionally, you will lose out on the built-in cross-domain
// features that the hubspot tracking code uses to store cookies.
// * You will need to have this script installed on every page.
@jakebellacera
jakebellacera / ajax-send.js
Created Feb 22, 2011
JQuery validate form that submits via AJAX
View ajax-send.js
/*
ajax-send.js - copyright Jake Bellacera (http://jakebellacera.com)
This script uses JQuery & JQuery Validate (https://github.com/jzaefferer/jquery-validation)
For this example, we will have a form named '#ajaxform', you can of course change this to whatever you'd like.
*/
$(function(){
$('#submitbutton').click(function() {
View floodlight-click-handler.js
document.getElementById("button").addEventListener("click", function(e) {
e.preventDefault();
var url = this.getAttribute("href", 2);
createFloodlightTag("source", "type", "cat", function() {
window.location = url; // Redirect the user after the tag successfully fires
});
});
function createFloodlightTag(source, type, cat, callback) {
@jakebellacera
jakebellacera / how-to-enable-sourcemaps.md
Last active Jun 14, 2019
How to enable source maps for your browser.
View how-to-enable-sourcemaps.md

How to enable source maps

Source mapping is a technique that "maps" your browser inspector's line numbers to the source file. This is useful when working with assets that are compiled from LESS, SASS, Coffeescript and so on. Source maps can also be used with minified assets that would normally have their line numbers removed. If you're curious, here's some more information regarding source maps.

Chrome

  1. Open Developer Tools.
    • Mac users: View > Developer > Developer Tools.
  2. Click the Settings cog icon in the upper-right corner of the Developer Tools window.
  3. Under the Sources section, check the box(es) for the source maps you want to enable.
@jakebellacera
jakebellacera / jquery.placeholder.js
Created Jul 15, 2011
jQuery Placeholder Plugin - Fixes the placeholder attribute on non-supported browsers.
View jquery.placeholder.js
/*
* Placeholder plugin for jQuery
* @author Daniel Stocks (http://webcloud.se)
*/
(function($) {
function Placeholder(input) {
this.input = input;
if (input.attr('type') == 'password') {
this.handlePassword();
}
View keybase.md

Keybase proof

I hereby claim:

  • I am jakebellacera on github.
  • I am jakebellacera (https://keybase.io/jakebellacera) on keybase.
  • I have a public key ASC4p2BMaTpJb1AMSJvdMhW60Cu5d_gmkrqk5kRDdrG1rwo

To claim this, I am signing this object:

You can’t perform that action at this time.