Skip to content

Instantly share code, notes, and snippets.

@luetkemj
luetkemj / style.css
Created March 9, 2012 16:32
WP-CSS: Wordpress classes
/* =============================================================================
WordPress WYSIWYG Editor Styles
========================================================================== */
.entry-content img {
margin: 0 0 1.5em 0;
max-width: 100%;
height: auto;
}
.alignleft, img.alignleft {
@besimhu
besimhu / WP Image - Image ID.html
Last active March 13, 2022 04:35
Different ways of pulling in images through Wordpress and ACF
/**
* Based off of image ID.
*
* You can use this method to pull in several different crops for responsive.
* The crop can be custom, or one of WP default ones, or leave empty.
*
* wp_get_attachment_image_src( $attachment_id, $size, $icon )
* http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src
*/
@besimhu
besimhu / Hamburger Menu.js
Last active August 29, 2015 14:17
A sample hamburger menu for mobile that animates into an "X" for when active.
module.exports = function() {
var $menu_trigger = $header.find('.menu-trigger');
// Trigger mobile navigation
$menu_trigger.on('click touch', function(e) {
$('body').toggleClass('nav-open');
e.preventDefault();
});
@besimhu
besimhu / Sass @each loop through Sass maps.css
Last active August 29, 2015 14:17
A simple @each function to loop through a Sass map and generate styles. This is especially handy for when you have and element that reiterates with different settings.
$brand_colors: (
purple $color-purple,
maroon $color-maroon,
orange $color-orange,
yellow $color-yellow,
);
.brand-color-bg {
@each $color in $brand_colors {
&.#{nth($color, 1)} {
// Markup Sample
<img src="<?php echo $image[0]; ?>"
width="<?php echo $image[1]; ?>"
height="<?php echo $image[2]; ?>"
alt="<?php echo $image_alt; ?>" />
// Markup Sample (Media Query Sync)
<figure>
<img class="responsive"
src="<?php echo $media_sml[0]; ?>"
// Markup
<img src="<?php echo $src; ?>"
alt="<?php echo $alt; ?>"
width="<?php echo $width; ?>"
height="<?php echo $height; ?>" />
/**
* Generate image markup through WP function.
*
* Requires ACF setting of ID.
* The crop can be custom, or one of WP default ones, or leave empty.
*
* This method does not work great with Media Query Sync. However, this method
* allows you to define custom settings, and the width, height, and alt tags will
* be auto generated for you. Which is great for semantics.
*
@vidaaudrey
vidaaudrey / ie67891011-css-hacks.txt
Created June 19, 2016 20:52 — forked from ricardozea/ie67891011-css-hacks.txt
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
@wojteklu
wojteklu / clean_code.md
Last active June 2, 2025 21:46
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules