Skip to content

Instantly share code, notes, and snippets.

View Saifadin's full-sized avatar
🎯
Focusing

Osamah Aldoaiss Saifadin

🎯
Focusing
View GitHub Profile
import { renderEmail } from 'postonents';
import EmailContainer from '@company/email-templates';
// EmailContainer is the entry point for the service and it gets the data passed to it
const html = await renderEmail(EmailContainer, { lang: lang.toLowerCase(), template, emailData: data });
// generic send function
sendEmail(html);
@Saifadin
Saifadin / useTypewriter.js
Last active January 25, 2019 18:31
Typewriter like "animation" for a string | Hooks
import { useState, useEffect } from 'react';
export const useTypeWriter = (text, startNow = true, speed = 100, skip) => {
const [toBeTyped] = useState(text);
const [displayedText, setDisplayedText] = useState('');
const [isDone, setIsDone] = useState(false);
const [intervalId, setIntervalId] = useState(null);
useEffect(
() => {
@Saifadin
Saifadin / customTheme.js
Created January 22, 2019 23:18
Gatsby Custom Playground Theme
export {
codeTheme: {
def: `#ffe036`,
property: `#9effe5`,
keyword: `#66b8ff`,
string: `#9effe5`,
punctuation: `#5c7180`,
comment: `#5c7180`,
background: `#241236`,
editorBackground: `#2c1742`,
(window.webpackJsonp = window.webpackJsonp || []).push([[5], {
1271: function(t, e, r) {
(function(t) {
var r, n, o, i;
function a(t) {
return (a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
return typeof t
}
: function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
@Saifadin
Saifadin / inline-react.html
Created February 17, 2019 20:48
Inline React
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script>
const e = React.createElement;
function SliderImage() {
return e('div', { className: 'tSlider--image-wrapper' }, e('img', { src: '//cdn.shopify.com/s/files/1/0116/9562/0160/t/3/assets/bg.png?7092974999273233205', className: 'tSlider--image' }));
};
@Saifadin
Saifadin / inline-react-result.html
Created February 17, 2019 20:52
Result of inline React code
<div class="tSlider">
<div class="tSlider--image-wrapper">
<img src="//cdn.shopify.com/s/files/1/0116/9562/0160/t/3/assets/bg.png?7092974999273233205" class="tSlider--image">
</div>
<div class="tSlider--sliderText">
<h1 class="tSlider--headline">Fun stuff</h1>
<span class="tSlider--subHeadline">
This is a React example without any transpiling <b>with a bold text</b>. ❤️
</span>
</div>