Skip to content

Instantly share code, notes, and snippets.

View etoxin's full-sized avatar

Adam Lusted etoxin

View GitHub Profile
@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')
*/
@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 / 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 / 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 / export-mongo.md
Last active June 22, 2017 06:00
Export a Mongo DB database

Export a mongo Database

first step is to list all databases. Get into the mongo terminal with mongo and run the follwing command to show all the DBs

show dbs

Show collections

@etoxin
etoxin / javascript.json
Last active June 23, 2017 04:30
VS Code User Snippets
{
"Print to console": {
"prefix": "1",
"body": [
"console.log(${TM_LINE_NUMBER}, '$1');",
"$2"
],
"description": "Log output to console"
},
"Simple function": {
@etoxin
etoxin / events.js
Created May 30, 2017 04:32
Native JS Stuff
document.body.addEventListener('click', (event) => {
if (event.target.className === 'class-name') {
// do stuff.
}
});
@etoxin
etoxin / WebService.js
Last active March 12, 2025 09:45
Sample ES6 Service Class
import forEach from 'lodash/forEach';
/**
* Sample Web Service
* This is a sample service class that uses fetch and promises.
*
* I am using the http://httpbin.org endpoint to ensure this example is working properly.
*
* @class sampleWebService
*/
class sampleWebService {
@etoxin
etoxin / grid.scss
Last active May 16, 2017 06:02
Foundation 6 SCSS Cheat Sheet
// Create a row
.class {
@include grid-row;
}
// create a column with options
.class {
@include grid-column(
$columns: 10,
$gutters: 1
@etoxin
etoxin / kitchenSink.html
Last active April 27, 2017 01:34
HTML Kitchen Sink
<h1>This is the primary heading and there should only be one of these per page</h1>
<p>A small paragraph to <em>emphasis</em> and show <strong>important</strong> bits.</p>
<ul>
<li>This is a list item</li>
<li>So is this - there could be more</li>
<li>Make sure to style list items to:
<ul>
<li>Not forgetting child list items</li>
<li>Not forgetting child list items</li>
<li>Not forgetting child list items</li>