Skip to content

Instantly share code, notes, and snippets.

<?php
class Test_Did_Action extends WP_UnitTestCase {
public function test_did_action_should_be_two_if_action_fired_twice() {
do_action( 'wink' );
do_action( 'wink' );
$this->assertEquals( 2, did_action( 'wink' ) );
}
public function test_did_action_should_be_one_if_action_fired_once() {
<style>
#big {
font-size: 25vw;
font-family: 'Helvetica Neue', sans-serif;
font-weight: bold;
}
#big:-webkit-full-screen {
width: 100%;
height: 100%;
margin: auto;
@nb
nb / бврд.txt
Last active May 23, 2016 15:33
думи, чийто съгласни са б, в, р, д
добрев
дробове
брадва
добрева
дъбрава
дърводобив
брадви
бърдаров
бодуров
бордови
@nb
nb / crontab
Created November 12, 2015 18:15
0 11 * * * /usr/local/bin/brew list > /Users/nb/backup/brew.list
0 11 * * * /usr/bin/crontab -l > /Users/nb/backup/crontab
0 11 * * * /bin/cp /Users/nb/lib/php/composer.json /Users/nb/backup/
0 11 * * * /bin/ls /Applications > /Users/nb/backup/apps.list
<?php
/**
* Retrieve category, tag, or term description.
*
* @since 4.1.0
*
* @return string Archive description.
*/
function get_the_archive_description() {
$description = '';
// to run place your solution in index.js and run: babel-node --stage 0 test.js
import assert from 'assert';
import toTitleCase from './index';
const tests = [
{
"input": "follow step-by-step instructions",
"expect": "Follow Step-by-Step Instructions"
},
{
"input": "this sub-phrase is nice",
import unittest
def is_interval(interval, **kwargs):
to_list = lambda value: [value] if isinstance(value, basestring) else value
list_from_kwarg = lambda key: to_list(kwargs.get(key, []))
units = ['y', 'm', 'd', 'h', 'i', 's']
only = list_from_kwarg('only')
if only:
return is_interval(interval, with_ = only, without = list(set(units) - set(only)))
with_ = list_from_kwarg('with_')
@nb
nb / gist:e6698066e0b0d686a026
Created February 20, 2015 22:53
ssh into a container for debugging
# look for the ID of the `default` VM
vagrant global-status
vagrant ssh <default-id>
# install nsenter
docker run -v /usr/local/bin:/target jpetazzo/nsenter
# get the container id, not the image id
docker ps
it( 'should handle series of same component', function() {
var expectedResultString = '<span><a href="#">baba</a><a href="#">dyado</a></span>',
translatedComponent = translate( '{{link}}baba{{/link}}{{link}}dyado{{/link}}', { components: { link: link } } );
assert.equal( expectedResultString, stripReactAttributes( React.renderToString( translatedComponent ) ) );
} );
it( 'should handle wrong cross-nesting', function() {
var expectedResultString = '', // how do we return error?
translatedComponent = translate( '{{link}}a{{em}}b{{/link}}c{{/em}}', { components: { link: link, em: em } } );
assert.equal( expectedResultString, stripReactAttributes( React.renderToString( translatedComponent ) ) );
@nb
nb / gist:677b416912e14ec44b16
Created September 18, 2014 13:22
Keybase Verification
### Keybase proof
I hereby claim:
* I am nb on github.
* I am nikolayb (https://keybase.io/nikolayb) on keybase.
* I have a public key whose fingerprint is 5B90 5510 BE15 69CB 2D45 146F 9452 16AC 9610 D078
To claim this, I am signing this object: