Skip to content

Instantly share code, notes, and snippets.

View geoffreycrofte's full-sized avatar
📚
Writing books

Geoffrey Crofte geoffreycrofte

📚
Writing books
View GitHub Profile
@geoffreycrofte
geoffreycrofte / Some solutions to fix it.
Created October 9, 2019 18:41
How to fix Gulp Issue: gulpInst.start.apply(gulpInst, toRun); TypeError: Cannot read property 'apply' of undefined.
npm i -g gulp-cli
@geoffreycrofte
geoffreycrofte / Get-Element-By-Style.js
Last active January 23, 2019 10:54
Get and mark elements on a page regarding their color or any other style.
// Paste that in your Browser console
let allBodyElements = document.querySelectorAll('body *'),
thePropertyName = 'color',
theExpectedValue = 'rgb(0, 82, 204)';
allBodyElements.forEach(function(el){
let style = window.getComputedStyle(el);
if ( style.getPropertyValue(thePropertyName) == theExpectedValue ) {
console.log(el);
el.style.boxShadow = '0 0 0 2px red';
@geoffreycrofte
geoffreycrofte / terminal
Created November 28, 2018 13:13
Get a count of lines of code in a Github Repository
$ git ls-files | xargs wc -l
@geoffreycrofte
geoffreycrofte / counting-in-css.css
Last active August 8, 2018 08:14
A way to apply styles depending on number of elements
li:only-of-type {
width: 100%;
}
/* if 2 <ul> childs */
li:nth-last-child(2):first-child,
li:nth-last-child(2):first-child ~ li {
width: 50%;
}
@geoffreycrofte
geoffreycrofte / child-functions.php
Created May 30, 2014 08:53
Translation for a WordPress Child Theme
<?php
/*
CHILD THEME functions.php file
*/
if ( !function_exists('child_localization')) {
function child_localization() {
load_child_theme_textdomain('child_text_domain', get_stylesheet_directory() . '/lang');
}
add_action('after_setup_theme', 'child_localization');
}
@geoffreycrofte
geoffreycrofte / functions.php
Last active July 6, 2016 16:20 — forked from stephanie-walter/gist:5014232
Add a Branch shortcode to WordPress
// Adds [branch id="" noscript="branch-url"] shortcode in WordPress
if ( ! function_exists( 'branch_embedded' ) ) {
function branch_embedded( $atts ) {
$atts = shortcode_atts( array( 'id' => '', noscript=> '' ), $atts );
$output = '<script type="text/javascript" src="http://embed-script.branch.com/assets/embed/embed.m.js?body=0" data-branch-embedid="' . esc_attr( $atts['id'] ) . '" ></script>';
@geoffreycrofte
geoffreycrofte / dabblet.css
Created September 27, 2012 12:00
Rating with float right or direction rtl properties
/**
* Rating with float right or direction rtl properties
*/
h1 {
text-align: center;
font-family: Helvetica, Arial;
font-weight: normal;
color: #777;
font-size: 1.3em;
clear: both;
@geoffreycrofte
geoffreycrofte / dabblet.css
Created September 24, 2012 15:10
Rating with float right or direction rtl properties
/**
* Rating with float right or direction rtl properties
*/
h1 {
text-align: center;
font-family: Helvetica, Arial;
font-weight: normal;
color: #777;
font-size: 1.3em;
clear: both;
@geoffreycrofte
geoffreycrofte / dabblet.css
Created September 13, 2012 17:15
"Isometric" shadow
/**
* "Isometric" shadow
*/
div {
position: relative;
width: 250px;
height: 200px;
background: #7799ff;
box-shadow: 10px 10px 0 #3355bb;
@geoffreycrofte
geoffreycrofte / dabblet.css
Created September 13, 2012 17:13
Feuilles superposées
/**
* Feuilles superposées
*/
/* Petite mise en page */
body {
width: 375px;
margin: 20px auto;
font-family: helvetica, arial, sans-serif;
color: #444;