Skip to content

Instantly share code, notes, and snippets.

View AyozeVera's full-sized avatar

Ayoze Vera Arbelo AyozeVera

View GitHub Profile
(function(document) {
var json = document.getElementsByTagName('pre')[0].innerText
var obj = JSON.parse(json)
var cards = obj.cards
var output = 0
cards.map(function(card, index) {
var pre = card.name.indexOf('[') + 1
var post = card.name.indexOf(']')
var value = card.name.substring(pre, post)
@AyozeVera
AyozeVera / Handler.js
Last active April 23, 2018 16:36
AdonisJS Handler code for retrieving errors as JSON instead of HTML
'use strict'
/**
* This class handles all exceptions thrown during
* the HTTP request lifecycle.
*
* @class ExceptionHandler
*/
class ExceptionHandler {
/**
@AyozeVera
AyozeVera / packages.list
Created January 14, 2018 17:58
My Atom Packages
auto-update-packages@1.0.1
autocomplete-modules@1.8.0
file-icons@2.1.15
git-blame@1.4.0
highlight-selected@0.13.1
linter@2.2.0
linter-eslint@8.4.0
linter-scss-lint@3.1.1
minimap@4.29.7
pigments@0.40.2
#!/usr/bin/env bash
# check if running as sudo
if [[ $UID == 0 ]]; then
echo "LOG => Please don´t run this script as sudo, it will ask for your password when required"
exit 1
fi
# packages
@AyozeVera
AyozeVera / gh-pages-deploy.md
Created April 26, 2018 22:32 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@AyozeVera
AyozeVera / gh-pages-deploy.md
Created April 26, 2018 22:32 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@AyozeVera
AyozeVera / lightmetter.ino
Created April 29, 2018 19:40
Arduino LightMetter & Relay
/*
Advanced BH1750 library usage example
This example has some comments about advanced usage features.
Connection:
VCC -> 3V3 or 5V
GND -> GND
@AyozeVera
AyozeVera / Cors.php
Created July 2, 2018 13:51
Laravel Cors Middleware configuration
<?php
namespace App\Http\Middleware;
use Closure;
class Cors
{
/**
* Handle an incoming request.
@AyozeVera
AyozeVera / CustomNodeFactory.js
Last active October 24, 2018 16:09
storm-react-diagrams
import { DiagramEngine, NodeModel, AbstractNodeFactory } from "storm-react-diagrams";
import { CustomNodeWidget, CustomNodeModel } from "../../components";
import * as React from "react";
export class CustomNodeFactory extends AbstractNodeFactory {
constructor() {
super("custom");
}
generateReactWidget(diagramEngine, node) {

Multiple MySQL Versions with Homebrew

For homebrew version 0.9.5.

brew -v # => Homebrew 0.9.5

Install the current version of mysql.

# Install current mysql version

brew install mysql