Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
YonatanKra / rAF.js
Created October 10, 2017 11:08 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@YonatanKra
YonatanKra / package.json
Created December 19, 2017 13:14
Package.json for the webpack project
{
"name": "your-webpack-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
@YonatanKra
YonatanKra / app.css
Created December 20, 2017 07:10
preliminary css
#phrase-form-wrapper {
min-height: 50px;
background: rgba(125, 125, 0, .25);
margin-bottom: 5px;
}
#phrase-fireworks-wrapper {
height: 450px;
outline: 1px red solid;
}
@YonatanKra
YonatanKra / form.index.html
Created December 20, 2017 08:00
form.index.html version 1
<form name="phrase-form">
<input name="phrase"
class="phrase-input"
type="text">
<input type="submit"
class="phrase-input-button" value="Start Awesomeness!">
</form>
@YonatanKra
YonatanKra / package.json
Last active December 25, 2017 12:22
Package.json after webpack-dev-server install
{
"name": "webpackPost",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"dev": "webpack-dev-server"
},
@YonatanKra
YonatanKra / webpack.config.js
Last active December 28, 2017 09:38
webpack.config.js with webpack-dev-server configured
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
devtool: 'inline-source-map',
devServer: {
open: true,
@YonatanKra
YonatanKra / webpack.config.js
Last active December 28, 2017 09:39
webpack basic configuration
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: './src/app.js', // this is our app
output: {
filename: '[name].bundle.js', // the file name would be my entry's name with a ".bundle.js" suffix
@YonatanKra
YonatanKra / form.index.js
Last active December 28, 2017 09:59
simple form index
// get the template
import template from './form.index.html';
// get the styles
import {} from './form.index.css';
class YOPFForm{
constructor(element) {
this._element = element;
this.setTemplate();
}
@YonatanKra
YonatanKra / app.js
Last active December 28, 2017 10:01
The app.js using the form's API
import template from './index.html';
import {} from './app.css';
import YOPFForm from './form/form.index';
import YOPFFireworks from './fireworks/fireworks.index';
(function() {
document.body.innerHTML = template;
const form = new YOPFForm(document.getElementById('phrase-form-wrapper'));
})();
@YonatanKra
YonatanKra / app.js
Last active December 28, 2017 10:04
Fireworks added to the mix
import template from './index.html';
import {} from './app.css';
import YOPFForm from './form/form.index';
import YOPFFireworks from './fireworks/fireworks.index';
(function() {
function onPhraseChange(phrase) {
fireworks.doFireworks(phrase);
}