Skip to content

Instantly share code, notes, and snippets.

View emadb's full-sized avatar
⌨️
coding

Emanuele DelBono emadb

⌨️
coding
View GitHub Profile
class BerlinClock
SECONDS = "Y"
HOURS_FIVES = "RRRR"
HOURS_ONES = "RRRR"
MINUTES_FIVES = "YYRYYRYYRYY"
MINUTES_ONES = "YYYY"
def initialize(h,m,s)
@h, @m, @s = h, m, s
end
/* This can be the start of a module */
const makeHandler = cb => {
return {
get (object, prop, receiver) {
if (Reflect.has(object, prop)) {
return Reflect.get(...arguments)
}
return new Proxy(() => {}, {
@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@Avaq
Avaq / combinators.js
Last active March 18, 2024 20:49
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))