Skip to content

Instantly share code, notes, and snippets.

@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);
}
@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 / app.js
Last active January 18, 2018 12:53
app.js with lazy loading of fireworks
import template from './index.html';
import {} from './app.css';
import YOPFForm from './form/form.index';
import 'jquery';
import 'bootstrap/dist/js/bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
(function() {
@YonatanKra
YonatanKra / app.js
Created December 31, 2017 13:26
Changing the app for lazy loading
import template from './index.html';
import {} from './app.css';
import YOPFForm from './form/form.index';
import 'jquery';
import 'bootstrap/dist/js/bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
(function() {
@YonatanKra
YonatanKra / webpack.common.js
Last active January 1, 2018 14:30
Splitting the config files for production and development
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: ['./src/app.js'], // this is our app
output: {
chunkFilename: '[name].bundle.js',
filename: '[name].bundle.js', // the file name would be my entry's name with a ".bundle.js" suffix
path: path.resolve(__dirname, 'dist') // put all of the build in a dist folder
/******/ // start chunk loading
/******/ var head = document.getElementsByTagName('head')[0];
/******/ var script = document.createElement('script');
/******/ script.type = 'text/javascript';
/******/ script.charset = 'utf-8';
/******/ script.async = true;
/******/ script.timeout = 120000;
/******/
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
export class LazyLoader{
static LoadTemplate(path, onLoadCallback, onErrorCallback) {
const script = document.createElement('script');
script.src = path;
script.onload = onLoadCallback;
script.onerror = onErrorCallback;
// you can do more here...
document.head.appendChild(script);
}
}
@YonatanKra
YonatanKra / index.html
Created June 26, 2018 10:23
Testing Cesium Entities Filtering - Step 1
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
@YonatanKra
YonatanKra / BitwiseAND
Last active August 11, 2018 06:22
BitwiseAND
function BitwiseAND(operand1, operand2) {
// convert to binary
let binary1 = (operand1 >>> 0).toString(2);
let binary2 = (operand2 >>> 0).toString(2);
// pad with zeros to the left to get 32bit binary
binary1 = binary1.padStart(32, '0');
binary2 = binary2.padStart(32, '0');
// if bigger than 32 bits, cut the most significant bits
@YonatanKra
YonatanKra / Bitwise OR
Last active November 8, 2021 09:09
Bitwise OR
function BitwiseAND(operand1, operand2) {
// convert to binary
let binary1 = (operand1 >>> 0).toString(2);
let binary2 = (operand2 >>> 0).toString(2);
// pad with zeros to the left to get 32bit binary
binary1 = binary1.padStart(32, '0');
binary2 = binary2.padStart(32, '0');
// if bigger than 32 bits, cut the most significant bits