Skip to content

Instantly share code, notes, and snippets.

View gemmadlou's full-sized avatar

Gemma Black gemmadlou

View GitHub Profile
@zsup
zsup / ddd.md
Last active June 9, 2024 15:02
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
@jsantell
jsantell / message-bus.js
Last active June 8, 2016 04:22
message-bus.js
/*
* CONTENT THREAD
*/
let responses = new Map();
let listener = ({ id, response }) => {
let callback = responses.get(id);
if (callback) {
responses.delete(id);
callback(response);
}
@mikedfunk
mikedfunk / test.php
Created March 20, 2014 23:41
phpdoc and psr-2 class example
<?php
/**
* Description
*
* @package RacingJunk
* @copyright 2014 Internet Brands, Inc. All Rights Reserved.
*/
namespace InternetBrands\RacingJunk;
/**
@developerinlondon
developerinlondon / docker.md
Last active January 9, 2024 11:31
Docker saving and loading images

Here's how to save and load docker images:

Example scenario: To save a docker image from a docker repository and save it as a tar file locally.

  1. Save the image as a tarball

docker save repositoryname:tag > repotag.tar

  1. Zip the image
@pburtchaell
pburtchaell / styles.css
Last active February 25, 2024 12:24
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
<?php
function free_and_premium() {
vc_map( array(
"name" => __("Premium", "js_composer"),
"base" => "premium",
"content_element" => true,
"category" => "content>",
"show_settings_on_create" => false,
"params" => array(
// add params same as with any other content element
@tracker1
tracker1 / 01-directory-structure.md
Last active June 4, 2024 14:31
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@avoelkl
avoelkl / gist:49563c516d6cb318eb34
Last active June 5, 2024 12:41
Non-blocking and quick database dumps for large databases

How-to

Add --single-transaction and --quick to your mysqldump command.

--single-transaction

sets the isolation mode to REPEATABLE READ and starts a transaction before dumping data. useful for InnoDB tables, dumps the consistent state without blocking any applications.

--quick

@lunelson
lunelson / SassMeister-input.scss
Last active September 7, 2017 14:29
iOS 7 vh unit workaround MIXIN
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
/*
_ ______ _ __ _
(_) |___ / | | / _(_)
_ ___ ___ / /_______ _| |__ ______| |_ ___ __