Skip to content

Instantly share code, notes, and snippets.

View eezhal92's full-sized avatar

Muhammad Rizki Rijal eezhal92

View GitHub Profile
@eezhal92
eezhal92 / strategy.js
Last active July 3, 2018 06:20
passport-oauth2/strategy.js
// Load modules.
var passport = require('passport-strategy')
, url = require('url')
, util = require('util')
, utils = require('./utils')
, OAuth2 = require('oauth').OAuth2
, NullStateStore = require('./state/null')
, SessionStateStore = require('./state/session')
, AuthorizationError = require('./errors/authorizationerror')
, TokenError = require('./errors/tokenerror')
body {
margin: 0 auto 2rem;
width: 600px;
padding: 0;
font-family: sans-serif;
font-size: 16px;
}
.contact {
border: 1px solid #ccc;
@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;
self.addEventListener('sync', function(event) {
if (event.tag == 'outbox') {
// sendEverythingInTheOutbox should return Promise
event.waitUntil(sendEverythingInTheOutbox());
}
});
@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);
@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 / 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 / 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={[]} />);
import React from 'react'
import { render } from 'react-dom'
const App = () => <div className="somehting">App</div>
render(
<App />,
document.querySelector('#app')
)
<?php
namespace App;
class Company extends Entity
{
/**
* @var int
*/