Skip to content

Instantly share code, notes, and snippets.

@awakekat
awakekat / Box-Sizing
Created July 4, 2014 01:51
This snippet of code should be placed into your css reset. It will save hours of frustration. You will thank me later. It has to with the box model and the included padding and margin. If a div is 100px tall and wide with padding of 10px it will expand to 120x120px. With the code below the div will not grow larger it will encapsulate and take on…
*, *::after, *::before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@awakekat
awakekat / gist:67ecfa953ce93cd7153b
Created July 5, 2014 01:44
Trigger CSS3 Transitions on Click using :target
// HTML MARKUP
<a href="#one">One</a>
<a href="#two">Two</a>
<a href="#three">Three</a>
<a href="#four">Four</a>
<p id="one">Number One</p>
<p id="two">Number Two</p>
@awakekat
awakekat / wpn2html
Last active August 29, 2015 14:03
Get WP into HTML sites
At the top of the (.PHP not .HTML) page you want to incorporate WP data:
<?php
define(‘WP_USE_THEMES’, false);
require(‘../wordpress/w-blog-header.php’);
?>
Where you want it to show up:
<!— LOOP START —>
@awakekat
awakekat / Tinted Images
Created August 1, 2014 03:56
Tinted Images with Multiple Backgrounds - CSS Tricks
/* Working method */
.tinted-image {
background:
/* top, transparent red, faked with gradient */
linear-gradient(
rgba(255, 0, 0, 0.45),
rgba(255, 0, 0, 0.45)
),
/* bottom, image */
url(image.jpg);
@awakekat
awakekat / Gulp Jade Example
Created December 18, 2014 03:42
Example of Gulp Jade
//From http://stackoverflow.com/questions/25384796/can-i-set-gulp-livereload-to-run-after-all-files-are-compiled
var gulp = require('gulp');
var jade = require('gulp-jade');
var gutil = require('gulp-util');
var stylus = require('gulp-stylus');
var jeet = require('jeet');
var nib = require('nib');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
@awakekat
awakekat / gulp example2
Created January 16, 2015 05:51
Gulp Example
So, I reproduce the problem you have and came accross this working solution.
First, lets check gulp plugins you need:
gulp-jade
gulp-livereload
optional: gulp-load-plugins
In case you need some of them go to:
http://gulpjs.com/plugins/
Search for them and install them.
Strategy: I created a gulp task called live that will check your *.jade files, and as you are working on a certain file & saving it, gulp will compile it into html and refresh the browser.
In order to accomplish that, we define a function called compileAndRefresh that will take the file returned by the watcher. It will compile that file into html and the refesh the browser (test with livereload plugin for chrome).
@awakekat
awakekat / UltimateGulp
Last active September 19, 2016 19:56
The Ultimate Gulpfile
// ====== Include gulp
var gulp = require('gulp');
// ===== Include Plugins
var server = require('gulp-server-livereload');
var plumber = require('gulp-plumber');
var livereload = require('gulp-livereload');
var notify = require('gulp-notify');
var concat = require('gulp-concat');
var jade = require('gulp-jade');
@awakekat
awakekat / Package.json
Created January 31, 2015 01:31
Package.json file
{
"name": "kwdev",
"version": "1.0.0",
"description": "Development",
"devDependencies": {
"connect": "^3.3.4",
"gulp": "^3.8.8",
"gulp-cache": "^0.2.4",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.4.2",
@awakekat
awakekat / Enqueue Font-awesome
Last active November 25, 2015 17:28
Wordpress Enqueue Font-Awesome
/* Enqueue css
/* ------------------------------------ */
function fa_styles()
{
wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/fonts/font-awesome.min.css' );
wp_enqueue_style( 'style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'fa_styles' );
@awakekat
awakekat / functions2
Created February 21, 2015 04:41
functions.php enqueueing child theme and fontawesome
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
//* Load Font Awesome
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' );