Skip to content

Instantly share code, notes, and snippets.

View NathanQ's full-sized avatar

Nathan Victor NathanQ

View GitHub Profile

Keybase proof

I hereby claim:

  • I am nathanq on github.
  • I am nathanq (https://keybase.io/nathanq) on keybase.
  • I have a public key ASCIwT8dOn14I-tDrGFuVHG6UDLIeHpqzWJkdUdfxTAuVAo

To claim this, I am signing this object:

@NathanQ
NathanQ / bootstrap_helpers.js
Last active November 10, 2017 23:34
Bootstrap accordion, tabs, and carousel helpers so the site looks and acts better
// scroll to heading of open collapse item so content is presented on the screen
$(function() {
$('.panel-collapse').on('shown.bs.collapse', function (e) {
var $panel = $(this).closest('.panel');
$('html,body').animate({
scrollTop: $panel.offset().top
}, 250);
});
});
@NathanQ
NathanQ / cloudSettings
Created July 11, 2017 18:03
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-07-11T18:03:41.418Z","extensionVersion":"v2.8.2"}
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@NathanQ
NathanQ / Bootstrap3 nav with Taxonomy3
Created November 8, 2016 22:52
The example nav is an unordered list for a max of 2 levels of nesting for ExpressionEngine Taxonomy plugin
<ul class="navbar-collapse bs-navbar-collapse collapse" role="navigation">
{exp:taxonomy:nav
tree_id="2"
display_root="no"
style="linear"
}
<li{if node_has_children} class="has-dropdown"{/if}>
<a href="{node_url}"
{if target_blank} target="_blank"{/if}
{if title_attribute} title="{title_attribute}"{/if}
@NathanQ
NathanQ / go-down-the-page-by-btn.js
Last active May 8, 2020 18:28
Jquery scroll down with a button. Yay!
$(function() {
$('.downzy-btn').click(function() {
var mp3 = {
prefix: "data:audio/mp3;base64,",
sound: [
"SUQzAwAAAAALClRJVDIAAABkAAAAAAAAAGQgRWZmZWN0cyAtIENvbWVkeS9DYXJ0b29uIEZBUlQgV0lUSCBHT09EIEVORElORzogU3RhcnRzIGJpZyBhbmQgbG91ZCwgZW5kcyB3aXRoIGEgYmFzaWMgJ3BycnQnVFBFMQAAADQAAABEb3dubG9hZCBTb3VuZCBFZmZlY3RzIC0gU291bmREb2dzIC0gQmpvcm4gTHlubmUgRlhUQUxCAAAAGQAAAGh0dHA6Ly93d3cuU291bmRkb2dzLmNvbVRSQ0sAAAACAAAAMFRZRVIAAAAFAAAAMjAwN1RDT04AAAAcAAAAU0ZYIC0gQ2FydG9vbnM7IEh1bWFucyBGYXJ0Q09NTQAAAC8AAABlbmcAUm95YWx0eSBGcmVlIFNvdW5kIEVmZmVjdHMgLSBTb3VuZGRvZ3MuY29tVENPTQAAAAEAAABXWFhYAAAAGgAAAABodHRwOi8vd3d3LlNvdW5kZG9ncy5jb21URU5DAAAAAQAAAFRDT1AAAAAsAAAAKGMpIDIwMTAgU291bmRkb2dzLmNvbSwgQWxsIFJpZ2h0cyBSZXNlcnZlZFRPUEUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@NathanQ
NathanQ / squarespacePopup.js
Last active November 13, 2017 15:01
Squarespace Add Popup Video To Background Image Modules using YUI, not jQuery
YUI().use('node', 'event', function (Y) { // use squarespace's preloaded YUI instead of loading jQuery just to make a popup. add this to the footer of your page in a snippet.
var videoLink = ''; // link your links to their videos in the content.
var top = pageYOffset;
var body = Y.one('body');
var obj;
var doClose = function(e) {
e.preventDefault();
var videoContent = document.getElementById('videoContent');
videoContent.parentNode.removeChild(videoContent);
Y.one('body').removeClass('sqs-lightbox-open');
@NathanQ
NathanQ / Track Files on Google Analytics
Created March 4, 2014 21:36
Javascript to track file downloads on Google analytics. This example takes a pdf link click and pushes the event to analytics with it's url. The setTimeout is there to give it a bit of time for the event tracking to occur before beginning the file download.
$(document).ready(function() {
$("a[href$='pdf']").click(function(event){
var href = $(this).attr('href');
_gaq.push(['_trackEvent', 'Downloads', 'File Downloaded', href]);
setTimeout(function() { window.location.href = href; }, 500 );
return false;
});
});
@NathanQ
NathanQ / Load section of html page into Bootstrap 3 modal
Created February 7, 2014 00:50
Bootstrap 3 will put a page into it's modal. Here is a way to add a section of the page to the modal using jQuery's .load().
<!-- link -->
<a href="/article.html" class="triggerModal" >
<!-- modal -->
<div id="modal" class="modal fade modal-dialog" tabindex="-1" role="dialog" aria-labelledby="yourMom" aria-hidden="true">
<div class="container">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<div class="row">
<div id="response_modal"></div>
</div>
@NathanQ
NathanQ / mySQL
Last active January 3, 2016 12:49
Reference for mySQL root user pw reset, backup of server database, get and use the database on mac.
The root password is gone. Shut off mySQL, restart, and set new password:
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
mysql
>>>> UPDATE mysql.user SET Password=PASSWORD('new easy and memorable pw') WHERE User='root';
Create new one if needed:
mysql -u projectuser -p
mysql
>>>> create database projectdb;