Skip to content

Instantly share code, notes, and snippets.

Kan Adachi obber

View GitHub Profile
View async-js-callbacks.md

Asynchronous Javascript (with callbacks)

Say that we have a function, getRandomDog that runs a callback function asynchronously with a dog object as an argument:

const getRandomName = function() {
  const names = ['puppy', 'buddy', 'sam'];
  return names[Math.floor(Math.random() * names.length)];
};
View js-vars-and-pointers.md

Take a look:

var a = 'hello';
var b = a;
a = 'world';
console.log(b); // what does this log?

View 01-checkin.md
View 02-checkin.md
View this-keyword-examples.js
var a = function() {
console.log(this);
};
// unwrapped
console.log(this); // window
// free function invocation
a(); // window
View lettering-archive.php
<?php
/**
* Template Name: Lettering Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_lettering_archive_template' ); // Add custom loop
You can’t perform that action at this time.