Skip to content

Instantly share code, notes, and snippets.

View andregomes's full-sized avatar

André Gomes andregomes

View GitHub Profile
@andregomes
andregomes / bootstrap-4-sass-mixins-cheat-sheet.scss
Created January 11, 2019 12:38
Bootstrap 4 Sass Mixins [Cheat sheet with examples] #BS4
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// @author http://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
<?php
/**
* MIME TYPES
* 'pdf' => 'application/pdf',
* 'swf' => 'application/x-shockwave-flash',
* 'mov|qt' => 'video/quicktime',
* 'flv' => 'video/x-flv',
* 'js' => 'application/javascript',
* 'avi' => 'video/avi',
<?php
/**
* Load Enqueued Scripts in the Footer
*
* Automatically move JavaScript code to page footer, speeding up page loading time.
*/
function footer_enqueue_scripts() {
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
/* http://meyerweb.com/eric/tools/css/reset/
  v2.0b1 | 201101
  NOTE: WORK IN PROGRESS
  USE WITH CAUTION AND TEST WITH ABANDON */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
<?php
// Add to the body_class function
function condensed_body_class($classes) {
global $post;
// add a class for the name of the page - later might want to remove the auto generated pageid class which isn't very useful
if( is_page()) {
$pn = $post->post_name;
$classes[] = "page_".$pn;
}
@andregomes
andregomes / wp-load-jqueryui.php
Created December 13, 2013 00:32
[WORDPRESS] Load JQuery UI
<?php
function add_jquery_ui() {
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-widget' );
wp_enqueue_script( 'jquery-ui-mouse' );
wp_enqueue_script( 'jquery-ui-accordion' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
wp_enqueue_script( 'jquery-ui-slider' );
wp_enqueue_script( 'jquery-ui-tabs' );
wp_enqueue_script( 'jquery-ui-sortable' );
@andregomes
andregomes / change_upload_path.php
Created November 29, 2013 15:38
Set the upload path or subdomain for uploaded images. wp3.5+
add_filter( 'pre_option_upload_url_path', 'subdomain_upload_url' );
function subdomain_upload_url()
{
return 'http://subdomain.domain.com/wp-content/uploads';
}
@andregomes
andregomes / css_resources.md
Created November 29, 2013 10:47 — 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

@andregomes
andregomes / 0_reuse_code.js
Created November 29, 2013 10:47
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
<?php
$mycontent = $post->post_content; // wordpress users only
$word = str_word_count(strip_tags($mycontent));
$m = floor($word / 200);
$s = floor($word % 200 / (200 / 60));
$est = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's');
?>
<p>Estimated reading time: <?php echo $est; ?></p>