Skip to content

Instantly share code, notes, and snippets.

@jjmartucci
jjmartucci / get-page-by-slug.php
Created June 21, 2016 13:02 — forked from matheuseduardo/get-page-by-slug.php
get_page_by_slug - wordpress
<?php
/**
* Retrieve a page given its slug.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $page_slug Page slug
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
* Default OBJECT.
* @param string|array $post_type Optional. Post type or array of post types. Default 'page'.

Keybase proof

I hereby claim:

  • I am jjmartucci on github.
  • I am jjmartucci (https://keybase.io/jjmartucci) on keybase.
  • I have a public key ASBVaxGHkdJt6wYD26tKvCCmLSO3ZqdlVbOxPJk5MzX-UQo

To claim this, I am signing this object:

@jjmartucci
jjmartucci / async-await-map.js
Created May 7, 2020 16:42
Using Async / Await with Array.map()
let characterResponse = await fetch(‘<http://swapi.co/api/people/2/>’)
let characterResponseJson = await characterResponse.json()
let films = await Promise.all(
characterResponseJson.films.map(async filmUrl => {
let filmResponse = await fetch(filmUrl)
return filmResponse.json()
})
)
console.log(films)
@jjmartucci
jjmartucci / copy-contents-bash.md
Created May 7, 2020 16:43
Copy the contents of one direction into another in Bash

cp -R ./src/. ./ e.g.

src/
	file1
	folder/
		file2
		file3

becomes

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}