Skip to content

Instantly share code, notes, and snippets.

View kabala's full-sized avatar

Carlos Santín kabala

  • Lighthouse web studio
  • Quito, Ecuador
View GitHub Profile
@kevinrodriguez-io
kevinrodriguez-io / eslint-prettier-ts-react-setup.conf
Created July 29, 2019 07:23
NextJS / React ESLINT + TS + PRETTIER SETUP
// .eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'react-app',
'plugin:prettier/recommended',
],
@twxia
twxia / getScrollableParent.js
Created January 5, 2018 03:41
Get Scrollable Parent
function getScrollParent(node) {
const isElement = node instanceof HTMLElement;
const overflowY = isElement && window.getComputedStyle(node).overflowY;
const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
if (!node) {
return null;
} else if (isScrollable && node.scrollHeight >= node.clientHeight) {
return node;
}
@mariocesar
mariocesar / api.js
Created September 26, 2017 04:21
Axios single configured instance
import axios from "axios";
const singleton = Symbol();
const singletonEnforcer = Symbol();
function readCookie(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
}
@T4rk1n
T4rk1n / action.js
Last active June 8, 2017 14:51
Redux store implementation with thunk and promise middleware.
export const fulfilled = (actionType) => `${actionType}_FULFILLED`
export const rejected = (actionType) => `${actionType}_REJECTED`
export const pending = (actionType) => `${actionType}_PENDING`
export const resetAction = (actionType) => `${actionType}_RESET`
/**
* Create a dictionary with all the phases of an async action
* @param {string} baseAction
*/
const createActionTypes = (baseAction) => ({
@narate
narate / rest-mongo.go
Last active May 26, 2020 10:07
Golang RESTful with MongoDB
// created by : Narate Ketram
package main
import (
"fmt"
"github.com/ant0ine/go-json-rest"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"net/http"
@jeffwhelpley
jeffwhelpley / gist:5417758
Last active July 21, 2022 12:07
Getting node.js http-proxy to play nice with restify. This will also work for http-proxy with express or another node.js server. Note that I took various snippets of my code for this gist in order to try and convey the general idea. It won't work to just run this file.
/*
I have an existing node.js API server that runs on top of restify. I wanted to add http-proxy to forward
some calls to another API server. From the http-proxy examples out there, it seemed simply enough:
*/
var httpProxy = require('http-proxy');
var proxy = new httpProxy.RoutingProxy();
var restify = require('restify');
var server = restify.createServer();
@ramseyp
ramseyp / hide-editor.php
Created November 12, 2012 15:48
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.