Skip to content

Instantly share code, notes, and snippets.

View gangsthub's full-sized avatar
Creative developer

Paul Melero gangsthub

Creative developer
View GitHub Profile
@gangsthub
gangsthub / dropdown-on-click.js
Last active May 4, 2016 19:30
Drop it like its hot
$(function(){
// dropdown function to pass to "dropdown actions"
// if you want the containers to be shown by default, add to the the class `.shown` in the markup
// Author: Paul Melero
// Url: https://gist.github.com/gangsthub/157a833258b43cfbeb64148b6d0dcc7c/
// Scroll func
var scrollSpeed = 500,
@gangsthub
gangsthub / styleLint.json
Created April 8, 2017 05:26
styleLint config
{
"extends": "stylelint-config-standard",
"rules": {
"indentation": 4,
"string-quotes": "single",
"no-duplicate-selectors": true,
"color-hex-case": "upper",
"color-hex-length": "short",
"selector-combinator-space-after": "always",
"selector-attribute-quotes": "always",
@gangsthub
gangsthub / startup.ps
Last active December 19, 2017 19:21
powershell startup command
powershell.exe -new_console:a -NoExit -command "& {Set-Location C:\htdocs}"
@gangsthub
gangsthub / _cols.scss
Last active March 27, 2018 08:15
Dynamic RWD cols
// collections
$CONTAINER-WIDTHS: (
5,
10,
20,
30,
40,
50,
60,
@gangsthub
gangsthub / index.html
Created April 4, 2018 11:22
vue simplest example
<div id="simplest-example">
<h1>{{ text }}</h1>
</div>
@gangsthub
gangsthub / easing.js
Created April 6, 2018 21:11 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@gangsthub
gangsthub / command.sh
Created July 25, 2018 08:30
PM2 start nuxt
# now run in your console: (I'm actually using powershell)
pm2 start .\ecosystem.config.js
@gangsthub
gangsthub / call vs bind
Last active July 4, 2019 16:32
A11y porpuse gists (for embedded code images)
// ⚡️
funFunction.bind(this).call()
// is the same as
funFunction.call(this)
@gangsthub
gangsthub / README.md
Last active July 16, 2020 16:40
`copytoclipboard`: Alternative to clipboard.js: Async implementation of "Copy to clipboard" in plain JS. Works in Safari, Chrome, Firefox, Opera and Edge Canary. Less than 1kb minified.

copyToClipBoard.js

copytoclipboard: Alternative to clipboard.js: Async implementation of "Copy to clipboard" in plain JS. Works in Safari, Chrome, Firefox, Opera and Edge Canary. Less than 1kb minified.

copyToClipBoard accepts an html element and returns a Promise.

Copies the content of the html element with the format included and also as plain text (both options).

📦 Install

@gangsthub
gangsthub / index.js
Created August 21, 2019 09:04
Detect if device is mobile from User Agent on Vuex
// See https://github.com/nuxt-community/device-module
const mutationTypes = {
CHANGE_MOBILE: 'CHANGE_MOBILE',
}
const checkIfMobileOnServerSide = ({ req, isServer }) => {
if (isServer) return false
const userAgent = req && req.headers['user-agent']
const isMobile = /mobile/i.test(('' + userAgent).toLowerCase())