Skip to content

Instantly share code, notes, and snippets.

<?php
// Which do you prefer?
return $some . '-' . $thing . '-' . $like . '-' . $this;
// OR
return implode('-', [$some, $thing, $like, $this]);
(if (= 3 4) 6 (+ (- (if (= 2 3) 96 (- (if (= 4 2) 92 (- (- (+ (- (if (= 2 2) 62 (- (if (= 2 4) 17 (+ (+ (+ (- (if (= 3 4) 7 (+ (- (+ (- (- (- (if (= 4 4) 42 (- (+ (- (- (if (= 5 2) 69 (- (- (if (= 5 4) 5 (- (+ (if (= 4 1) 20 (+ (if (= 4 5) 47 (if (= 2 5) 35 (- (if (= 2 2) 68 (if (= 5 5) 52 (+ (+ (+ (- (- (+ (if (= 5 3) 54 (- (- (if (= 2 3) 6 (- (+ (+ (- (if (= 5 5) 69 (if (= 1 1) 56 (- (+ (- (+ (- (- (- (if (= 3 5) 24 (- (- (if (= 3 5) 44 (- (if (= 5 3) 25 (+ (- (+ (- (+ (+ (+ (+ (+ (if (= 2 3) 23 (- (+ (if (= 4 2) 69 (+ (- (if (= 5 4) 56 (if (= 1 4) 85 (- (+ (- (if (= 1 3) 66 (- (if (= 5 3) 28 (if (= 2 2) 4 (if (= 4 2) 6 (if (= 1 4) 92 (if (= 4 4) 79 (+ (if (= 3 5) 13 (if (= 4 3) 47 (- (- (if (= 2 1) 27 (if (= 1 4) 91 (+ (+ (if (= 5 5) 84 (- (+ (- (- (+ (if (= 5 5) 14 (- (+ (+ (+ (+ (- (+ (+ (if (= 1 4) 39 (- (if (= 2 2) 48 (- (- (if (= 5 5) 37 (+ (- (if (= 4 5) 18 (if (= 2 3) 26 (if (= 5 3) 9 (+ (- (+ (if (= 4 4) 50 (+ (- (- (- (- (if (= 2 1) 19 (- (- (+ (- (+ (if (= 2 2) 45 (if (= 5 1) 47 (if (= 4 4) 42 (+
"(+ 1 1)" calculates to 2
"(if (= 13 46) 88 20)" calculates to 20
"(+ (- (if (= 87 78) 36 41) 53) 64)" calculates to 52
"(- (+ (if (= 63 81) 56 (- (+ 20 84) 45)) 58) 72)" calculates to 45
Sample Game:
327/XX8/9/4/247/11
How many frames scored a 20 or more?
frame 1 2 3 4 5 6 7 8 9 10
balls 32 7/ X X 8/ 9/ 4/ 24 7/ 11
score 5 20 28 20 19 14 12 6 11 2
In the example above, there are 3.
@ahuggins
ahuggins / Foo.js
Last active January 25, 2019 02:13
A simple Foo Component
import React from 'react';
import { Bar } from './Bar';
export function Foo() {
return <div>
<div className="fooClass">
<Bar />
</div>
</div>;
}
@ahuggins
ahuggins / Bar.js
Created January 24, 2019 21:23
Simple Bar Component
import React from 'react';
export function Bar() {
return <div>
<div className="barClass">Something here</div>
</div>;
}
@ahuggins
ahuggins / Foo.spec.js
Created January 25, 2019 02:14
Foo spec for testing
import React from 'react';
import { render, mount, shallow } from 'enzyme';
import { Foo } from 'Foo';
describe('Test for Foo component', function () {
it('can mount Foo component', function () {
const wrap = shallow(
<Foo />
);
@ahuggins
ahuggins / Foo.js
Created January 25, 2019 15:05
Another simple component example
import React from 'react';
export function Foo() {
return <div>
<div className="fooClass">
<Bar className="someCustomClass" />
</div>
</div>;
}
@ahuggins
ahuggins / foo.spec.js
Created January 25, 2019 15:17
Testing className passed as a prop
import React from 'react';
import { render, mount, shallow } from 'enzyme';
import { Foo } from 'Foo';
describe.only('Test for Foo component', function () {
it('can mount Foo component', function () {
const wrap = mount(
<Foo />
);
@ahuggins
ahuggins / Foo.spec.js
Created January 25, 2019 15:28
Debug className issue
import React from 'react';
import { render, mount, shallow } from 'enzyme';
import { Foo } from 'Foo';
describe.only('Test for Foo component', function () {
it('can mount Foo component', function () {
const wrap = mount(
<Foo />
);
console.log(wrap.find('.someCustomClass').debug());