Skip to content

Instantly share code, notes, and snippets.

@marcbacon
marcbacon / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@marcbacon
marcbacon / javascript_resources.md
Last active August 29, 2015 14:12 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@marcbacon
marcbacon / css_resources.md
Last active August 29, 2015 14:12 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@marcbacon
marcbacon / Change Domain WordPress.php
Last active October 18, 2017 21:03
[Change a WordPress Domain] Used to change a WordPress site's domain. #wordpress
//In wp-config.php:
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
//In functions.php:
update_option('siteurl','http://example.com');
update_option('home','http://example.com');
@marcbacon
marcbacon / WordPress wp-config settings.php
Last active October 18, 2017 21:04
[Misc. settings for wp-config.php] #wordpress
// Limit post revisions to 2
define( 'WP_POST_REVISIONS', 2 );
// Save queries
define('SAVEQUERIES', true);
// Move uploads folder
define( 'UPLOADS', 'blog/wp-content/uploads' );
// Disable Cron
@marcbacon
marcbacon / jQuery Hover.js
Last active August 29, 2015 14:20
jQuery .hover function
$('.class').hover(
function() {
//do stuff on hover
}, function() {
//do stuff after hover
}
);
@marcbacon
marcbacon / jQuery Click.js
Last active August 29, 2015 14:20
jQuery .click function
$('.class').click(function() {
//do stuff on click
});
@marcbacon
marcbacon / Bootstrap Carousel Item Normalization.js
Last active August 19, 2018 22:12
jQuery function to set all Bootstrap Carousel items to the same height.
@marcbacon
marcbacon / Redirect on Login.php
Last active August 29, 2015 14:22
If a visitor is not logged into the WordPress site, send them directly to the login page. After they have logged in, redirect them back to the home page.
// Place in functions.php or in a plugin
function redirection() {
if ( ! is_user_logged_in() ) {
wp_redirect( '/wp-login.php?redirect_to=' . home_url() );
exit;
}
} // end function
add_action( 'get_header', 'redirection' );
@marcbacon
marcbacon / Scroll Direction.js
Created June 26, 2015 18:53
Detect scroll direction using jQuery
var iScrollPos = 0;
$(window).scroll(function () {
var iCurScrollPos = $(this).scrollTop();
if (iCurScrollPos > iScrollPos) {
//Scrolling Down
} else {
//Scrolling Up
}
iScrollPos = iCurScrollPos;