Skip to content

Instantly share code, notes, and snippets.

View arikanmstf's full-sized avatar

Mustafa Arıkan arikanmstf

View GitHub Profile
@arikanmstf
arikanmstf / connect.js
Created June 28, 2018 11:15
React DOM & Native - Code Sharing - Connecting ui to component
import React from 'react';
const connect = (mapUiToProps) => (
(WrappedComponent) => {
const uiComponents = mapUiToProps();
return (props) => (
<WrappedComponent
{...uiComponents}
{...props}
/>
@arikanmstf
arikanmstf / index.html
Last active December 14, 2020 10:54
Service Worker Communication
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"/>
<meta name="google" content="notranslate"/>
<meta name="msapplication-tap-highlight" content="no"/>
<meta http-equiv="cache-control" content="no-store"/>
<meta http-equiv="expires" content="0"/>
navigator.serviceWorker.register('/assets/service-worker.js', { scope: '/' })
.then(function() {
return navigator.serviceWorker.ready;
})
.then(function(registration) {
console.log(registration); // service worker is ready and working...
});
@arikanmstf
arikanmstf / service-worker.js
Created February 9, 2018 13:39
Service Worker Example
self.addEventListener('push', function (event) {
if (event && event.data) {
const data = event.data.json();
event.waitUntil(self.registration.showNotification(data.title, {
body: data.body,
icon: data.icon || null
});
}
});
@arikanmstf
arikanmstf / App-MUI.jsx
Last active September 19, 2017 09:04
Application with MUI
import React, { Component } from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import AppBar from 'material-ui/AppBar';
import AutoComplete from 'material-ui/AutoComplete';
import Avatar from 'material-ui/Avatar';
import RaisedButton from 'material-ui/RaisedButton';
import Chip from 'material-ui/Chip';
import DatePicker from 'material-ui/DatePicker';
import Dialog from 'material-ui/Dialog';
@arikanmstf
arikanmstf / index.scss
Created July 31, 2017 21:45
Using scss to import bootstrap
@import "~bootstrap/dist/css/bootstrap.css";
/* All of the other imports comes after the bootstrap so we can overwrite it ! */
@import "common/font.scss";
@import "common/color.scss";
@import "common/grid.scss";
@arikanmstf
arikanmstf / index.ejs
Last active July 31, 2017 21:33
Using npm to import bootstrap
<!DOCTYPE html>
<!-- There is no more bootstrap import thanks to God and npm -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name= "description" content="<%= htmlWebpackPlugin.options.description %>"/>
<title>My Library</title>
</head>
<body>
<div class="main-content"></div>
@arikanmstf
arikanmstf / index.ejs
Last active July 31, 2017 21:18
Dynamic Html Bootstrap - Webpack
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.extraFiles.css %>">
<title>My Library</title>
</head>
<body>
<div class="main-content"></div>
</body>
@arikanmstf
arikanmstf / index.html
Last active July 31, 2017 21:56
Static Import Bootstrap
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<title>My Library</title>
</head>
<body>
<div class="main-content"></div>
</body>