Skip to content

Instantly share code, notes, and snippets.

View eezhal92's full-sized avatar

Muhammad Rizki Rijal eezhal92

View GitHub Profile
@eezhal92
eezhal92 / query.sql
Created February 13, 2016 02:58
sql sleekr
select c.name, count(u.name) as co from company c
join users u on c.id = u.company
where datediff(now(), u.join_date) >= 365
and u.gender = 'male' group by c.name;
<?php
class Calculator
{
/**
* Add multiple argument
*
* @return int
*/
<?php
namespace App;
class Company extends Entity
{
/**
* @var int
*/
import React from 'react'
import { render } from 'react-dom'
const App = () => <div className="somehting">App</div>
render(
<App />,
document.querySelector('#app')
)
@eezhal92
eezhal92 / TodoList.spec.jsx
Last active March 18, 2017 10:26
TodoList.spec.js__2
// src/components/TodoList.spec.js
import React from 'react';
import { shallow } from 'enzyme';
import TodoList from './TodoList';
// 1. Menampilkan header / judul yang benar. yaitu: My Todo List
it('shows correct header', () => {
const subject = shallow(<TodoList entries={[]} />);
@eezhal92
eezhal92 / TodoForm.spec.jsx
Last active March 19, 2017 15:03
TodoForm.spec.jsx
import React from 'react';
import { shallow } from 'enzyme';
import TodoForm from './TodoForm';
it('should not call onSubmit callback when the input less than 5 characters', () => {
const onSubmitSpy = jest.fn();
const preventDefaultSpy = jest.fn();
const resetSpy = jest.fn();
const subject = shallow(
@eezhal92
eezhal92 / findMinMax.js
Last active July 19, 2017 15:23
findMinMax.js
const pluck = key => list => list[key];
const pluckX = pluck('x');
const pluckY = pluck('y');
const groupXAndY = list => {
return {
listX: list.map(pluckX),
listY: list.map(pluckY),
};
@eezhal92
eezhal92 / detail.js
Last active October 12, 2017 10:54
Bg Sync Demo
function offerBgSync(err) {
if (!window.navigator.onLine) {
showBgSyncOffer();
listen.approveBgSync((event) => {
askNotificationPermission()
.then(queueRecipeLoad)
.then(getServiceWorkerRegistration)
.then(registerBgSync)
.then(showBgSyncApproval);
self.addEventListener('sync', function(event) {
if (event.tag == 'outbox') {
// sendEverythingInTheOutbox should return Promise
event.waitUntil(sendEverythingInTheOutbox());
}
});
@eezhal92
eezhal92 / todo-list.css
Created January 24, 2018 12:13
todo-list.css
body {
width: 600px;
margin: 0 auto;
padding: 0 2rem;
font-family: sans-serif;
font-size: 16px;
}
.todo {
overflow: hidden;