Skip to content

Instantly share code, notes, and snippets.

View etoxin's full-sized avatar

Adam Lusted etoxin

View GitHub Profile
@etoxin
etoxin / index.html
Created July 25, 2017 01:33
Content-Security-Policy-Report-Only
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta http-equiv="Content-Security-Policy" content="default-src https://ajax.googleapis.com; child-src 'none'; object-src 'none';">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<h1>test</h1>
<script>
@etoxin
etoxin / browser.js
Created August 14, 2017 02:10
Browser detect
import isString from 'lodash/isString';
export class Browser {
/**
* Creates an instance of Browser.
* @memberof Browser
*/
constructor() {
this.setClassOnBody(this.detectBrowser());
@etoxin
etoxin / Dockerfile___node
Last active September 6, 2017 14:13
Docker
FROM node:boron
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json .
# For npm@5 or later, copy package-lock.json as well
# COPY package.json package-lock.json ./
@etoxin
etoxin / classHelper
Created December 11, 2017 01:50
ClassList Helper
/**
* Class helper
* @param className
* @param method
* @param element
* @returns {*}
* @example curry(classHelper)('myClass')('contains')
* @example curry(classHelper)('myClass')('add')
* @example curry(classHelper)('myClass')('remove')
*/
console[console.info ? 'info' : 'log'] ("Hello world")
@etoxin
etoxin / README.md
Created January 30, 2018 04:38
Sample Readme.md
@etoxin
etoxin / Parallelism.js
Created February 8, 2018 00:23
Parallelism
// Will take 1000ms total!
async function series() {
await wait(500);
await wait(500);
return "done!";
}
// Would take only 500ms total!
async function parallel() {
const wait1 = wait(500);
@etoxin
etoxin / Functional_Programming_Cheat_Sheet.md
Last active January 7, 2021 13:58
Functional Programming Cheat Sheet

Functional Programming Cheat Sheet

Arrow Functions (Fat Arrows)

Arrow functions create a concise expression that encapsulates a small piece of functionality. Additionally, arrows retain the scope of the caller inside the function eliminating the need of self = this.

Example

// const multiply = function(x,y) {

@etoxin
etoxin / assert.js
Created June 28, 2018 07:26
Assert
/**
* @param {boolean} condition
* @param {string} msg
*/
export function assert (condition, msg) {
if (!condition) throw new Error(`[assert error] ${msg}`)
}