Skip to content

Instantly share code, notes, and snippets.

View boombang's full-sized avatar

Artem Kazaryan boombang

View GitHub Profile
var myRevealingModule = (function () {
var privateVar = "Ben Cherry";
var publicVar = "Hey there!";
function privateFunction() {
console.log( "Name:" + privateVar );
}
function publicSetName( strName ) {
privateVar = strName;
//my-module.js
var privateVar = "Ben Cherry";
var publicVar = "Hey there!";
function privateFunction() {
console.log( "Name:" + privateVar );
}
function publicSetName( strName ) {
privateVar = strName;
//my-module.js
define([], function() {
var privateVar = "Ben Cherry";
var publicVar = "Hey there!";
function privateFunction() {
console.log( "Name:" + privateVar );
}
function publicSetName( strName ) {
//my-module.js
let privateVar = "Ben Cherry";
export const publicVar = "Hey there!";
const privateFunction = () => {
console.log( "Name:" + privateVar );
}
export const publicSetName = (strName) => {
privateVar = strName;
//array.js
export function each(collection, callback) {
//something interesting
}
export function filter(collection, callback) {
//something interesting
each(collection, ...)
//something interesting
const { resolve, join } = require('path')
const CompressionPlugin = require('compression-webpack-plugin')
module.exports = {
entry: './app.js',
output: {
path: resolve(join(__dirname, 'build')),
filename: 'app.js'
},
module: {
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>initial hmtl example</title>
<link href="/static/css/main.487d312c.css" rel="stylesheet">
</head>
lampard =
{ name = "Frank"
, lastname = "Lampard"
, age = 41
}
type alias Player =
{ name : String
, lastname : String
list =
[ 1, 2, 3, 4 ]
push =
list ++ [ 5 ]
unshift =
0 :: list
type Maybe a
= Just a
| Nothing
-- Partial Functions
-- toFloat : String -> Maybe Float
a =
String.toFloat "123"