Skip to content

Instantly share code, notes, and snippets.

@laras126
laras126 / enqueue.php
Last active December 24, 2018 16:19
Potentially useful way to enqueue bundled assets in WordPress
<?php
function enqueue_theme_assets() {
// Get the current template and remove the file extension.
global $template;
$template_file = basename( $template );
$bundle_name = str_replace( '.php', '', $template_file );
$template_dir = get_template_directory_uri();
@laras126
laras126 / config.json
Last active November 6, 2018 16:07
This might work
{
"dir": {
"input": "./_assets/",
"output": "./dist/assets/"
}
}
@laras126
laras126 / block.js
Last active April 14, 2018 18:41
WordCamp San Diego 2018, block.js
/**
* BLOCK: sponge-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@laras126
laras126 / gutenberg.md
Last active March 14, 2018 01:02
A Gentle Introduction to Gutenberg Development: WordPress Meetup, Pittsburgh; March 13, 2018

A Gentle Introduction to Gutenberg Development

WordPress Meetup, Pittsburgh; March 13, 2018

Hello!

I'm Lara, not Laura.

@laras126 on Twitter // notlaura.com

@laras126
laras126 / guten-talk-notes.md
Last active November 5, 2023 00:37
Gutenberg Block Development notes (Hollywood WP Meetup 1-31-18)
@laras126
laras126 / max-diff.js
Last active November 12, 2017 23:16
Calculating max diff
const findDifference = (a, b) => {
let diff = a - b;
return diff;
}
const findMaxDifference = (arr) => {
let diff = 0,
max_diff = 0,
min = array[0],
@laras126
laras126 / anagram.js
Created November 9, 2017 04:02
Annotated Algorithm: Check if two strings are an anagram
// Task at hand:
// Write a function that determines if two strings are anagrams.
// Yikes!
// Note: Another way to solve this would be to sort each string alphabetically
// and then see if they are the same...but that's too easy!
const checkIfContains = (char, array) => {
let count = 0;
@laras126
laras126 / linked-list.js
Last active January 4, 2021 01:29
Linked List in JavaScript
// You can run this code by downloading it and typing in your console: node linked-list.js
// See the accompanying blog post here:
// And all of this is an ES6 adaptation of this excellent tutorial bu Cho S. Kim on CodeTuts: https://code.tutsplus.com/articles/data-structures-with-javascript-singly-linked-list-and-doubly-linked-list--cms-23392
// Create the object prototype for a "Node", that is, a list item (note that there is no technical relation to node.js or a "Node" in terms of the DOM)
class Node {
constructor(data) {
this.data = data;
@laras126
laras126 / jquery-for-ui.js
Created October 17, 2017 18:27
Code Sample: jQuery for UI elements
$(document).ready( function() {
// Only run this code on the Pays d'Oc page template
if( $('body').hasClass('page-template-template-paysdoc') ) {
// Get the exisitng DOM items
var $ITEMS = $('.pd-item'),
$CARDS = $('.pd-card'),
@laras126
laras126 / app.js
Last active August 15, 2017 17:28
JS for a front-end prototype (ES6, Vue.js)
// ----
// Components
// ----
const Modal = {
template: '#modal'
}
const ShareModal = {