Skip to content

Instantly share code, notes, and snippets.

View gjjones's full-sized avatar

Greg Jones gjjones

View GitHub Profile
@gjjones
gjjones / foo.php
Created July 11, 2017 20:17
Dealing with oEmbed
require_once( ABSPATH . 'wp-includes/class-oembed.php' );
$WP_oEmbed = new WP_oEmbed();
$data = $WP_oEmbed->get_data( $video_url );
$thumbnail_url = $data->thumbnail_url;
// to be stored in data attribute until needed
$lightbox_markup = htmlentities( $WP_oEmbed->data2html( $data, $video_url), ENT_QUOTES );
{
"empty-lines-between-children-rules": 0,
"empty-lines-between-media-rules": 0,
"sort-order": [
[ "$variable" ],
[
"position",
"top",
"right",
"bottom",
{
"rules": {
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always",
"block-opening-brace-newline-after": "always",
"block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"declaration-colon-space-after": "always",
"declaration-colon-space-before": "never",
@gjjones
gjjones / ebsco.json
Last active June 22, 2016 18:17
CSS rule sorting config
{
"empty-lines-between-children-rules": 0,
"empty-lines-between-media-rules": 0,
"sort-order": [
[ "$variable" ],
[
"position",
"top",
"right",
"bottom",
@gjjones
gjjones / main.js
Created December 30, 2015 16:25
redux-like collection bindings
/*eslint-disable no-unused-vars*/
import React from 'react';
/*eslint-enable no-unused-vars*/
import ReactDOM from 'react-dom';
const connectCursor = (bindings) => {
return (Component) => {
return (props) => Component(bindings(props));
};
}
@gjjones
gjjones / gist:14ff3f528b3253b59525
Last active November 4, 2015 18:42
storing gruntifle using browsersync and browserify for react(jsx)
var browserSync = require('browser-sync');
module.exports = function (grunt) {
grunt.initConfig({
watch: {
options: {
spawn: false
},
compiled: {
files: ['app/build/bundle.js'],
@gjjones
gjjones / grunt jekyll basic
Created April 21, 2014 00:36
This is a sample Gruntfile to run the basic 'jekyll build' with local server and livereload on changes. The grunt plugin can do this stuff without connect/watch, but I wanted more control over the options for other build steps.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
default: {
files: ['**/*.*', '!_site/**.*'],
tasks: ['jekyll'],
@gjjones
gjjones / queryStylesForTree.js
Created April 10, 2014 18:38
generate computed styles for node down through children
var element = document.getElementById('foo');
var nodes = [element];
var value = '';
var counter = 1;
while (nodes.length > 0) {
element = nodes.shift();
Array.prototype.map.call(element.children, function(node){nodes.push(node);});
value += ['\n/*',counter++,'*/\n'].join('');