Skip to content

Instantly share code, notes, and snippets.

View zouhir's full-sized avatar
🪀
Yoyo

Zouhir ⚡️ zouhir

🪀
Yoyo
View GitHub Profile
@zouhir
zouhir / site.js
Last active December 18, 2017 04:50
SYDPWA Meetup - Dec. 6th 2016
// ensure no console errors or issues in older browsers
// check for service worker first
if(navigator.serviceWorker) {
navigator.serviceWorker.register('/sw.js' /* , options */)
.then(function(regsitered) {
console.log('yay! registered')
}).catch(function() {
console.log('oh no! somethings wrong')
})
rm -rf ~/.atom
rm /usr/local/bin/atom
rm /usr/local/bin/apm
rm ~/Library/Preferences/com.github.atom.plist
rm ~/Library/Application Support/com.github.atom.ShipIt
rm -rf ~/Library/Application Support/Atom/
@zouhir
zouhir / simple.md
Last active January 22, 2017 22:57
Preact Widget Documentation
<div id="external-widget-place">
  <script async src="/your/widget.bundle.js"></script>
</div>
@zouhir
zouhir / multiple.md
Last active January 23, 2017 02:53
Multiple Preact Widgets Clones
<!-- your widget -->
<div id="external-widget-place">
  <script async src="/your/widget.bundle.js"></script>
</div>
<!--// tada.. -->

<!-- another clone here please -->
<div class="clone-that-widget-here-1">
 

Keybase proof

I hereby claim:

  • I am zouhir on github.
  • I am zouhir (https://keybase.io/zouhir) on keybase.
  • I have a public key ASC9aPI__VVNU3JthEMSSotud-MfLKVyo6ewYfFZmwYZAQo

To claim this, I am signing this object:

```bash
npm install --save preact-habitat
```
```js
import { render } from 'preact-habitat';
import WidgetAwesome from './components/WidgetAwesome'
render(WidgetAwesome);
```
#!/usr/bin/env bash
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Make sure we’re using the latest Homebrew.
brew update
# Upgrade any already-installed formulae.
brew upgrade
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@zouhir
zouhir / Dockerfile
Created June 20, 2017 00:17
Preact Boilerplate Dockerfile
FROM node:6.9.2
# File Author / Maintainer
LABEL authors="Zouhir Chahoud <[email protected]>"
# Install app dependencies
COPY package.json /www/package.json
RUN cd /www; npm install
# Copy app source
@zouhir
zouhir / index.js
Created August 10, 2017 05:25
React Widgets + AEM
import Widget from './widget.jsx';
import habitat from 'react-new-tyson-module';
const widgetInAem = habitat(Widget);
widgetInAem.render({
selector: '.booking-widget', // you can also use id #widgetId or data attribute [data-attribute-widget="mny-widget"]
inline: false, //optional
clean: false, //optional cleans the loading div or anything in the DOM after we mounr
clientSpecified: false //optional