Skip to content

Instantly share code, notes, and snippets.

View d-levin's full-sized avatar

Dennis Levin d-levin

  • New York City, NY
View GitHub Profile
@d-levin
d-levin / .gitignore
Created January 2, 2018 18:46
Universal gitignore
# Editors
.idea
.vscode
# OS
.DS_Store
# Misc
node_modules/
@d-levin
d-levin / dtmf-regex.js
Created November 29, 2017 17:05
DTMF tones only
// 0-9, #, and *
const dtmfRegex = /^[\d#*]+$/
@d-levin
d-levin / DashboardLayout.vue
Created October 17, 2017 16:15
A simple responsive dashboard layout component with a collapsible drawer
<template>
<div class="wrapper">
<transition name="fade">
<div v-if="drawerOpenOnMobile" class="overlay" @click="toggleDrawer"></div>
</transition>
<transition name="slide">
<aside v-if="drawerOpen" class="drawer">
<p>First item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Drawer item</p><p>Last item</p>
</aside>
</transition>
@d-levin
d-levin / GenericInput.js
Created May 24, 2017 01:36
Generic input component for Vuejs that supports dynamic input type
/**
* Generic input component of type [text] or [number]
*/
export default {
render (createElement) {
return createElement(
'input',
{
'class': {
'has-error': this.hasErrorClass && !this.hasValidClass,
@d-levin
d-levin / permissions-directive.js
Last active May 20, 2017 12:55
Simple permissions directive for Vue.js
const args = {
SOME: 'some',
EVERY: 'every'
}
const permissions = [
'create',
'view',
'update',
'delete'
@d-levin
d-levin / atom-styles.css
Created January 27, 2017 03:45
A way to make notifications in Atom less intrusive
/*
* The following has been tested to work in Atom v1.13.1 x64
* Add the styles to styles.less accessible from Atom -> Stylesheet...
*/
atom-notification {
height: 32px !important;
width: 32px !important;
}
@d-levin
d-levin / api-module.js
Last active July 9, 2024 04:58
Reusable Javascript ES6 API module using Axios
import axios from 'axios'
function httpRequest (method, url, request) {
return axios[method](url, request)
.then(response => Promise.resolve(response))
.catch(error => Promise.reject(error))
}
export default {
get (url, request) {