Skip to content

Instantly share code, notes, and snippets.

View dianjuar's full-sized avatar

Diego Julião dianjuar

  • Medellín - Colombia
  • 10:08 (UTC -05:00)
  • X @dianjuar
View GitHub Profile
@dianjuar
dianjuar / stat1-teams-registered.ts
Last active February 17, 2018 00:18
FIFA Manager PWA
/**
* How many teams are registered
*/
howManyTeamsAreRegistered(): number {
return this.teamsService.getElements().length;
}
@dianjuar
dianjuar / WooCommerce admin bar and dashboard access.md
Last active April 18, 2018 16:43
With the Woocommerse plugin installed, allow some roles to access to the WordPress Dashboard using a hook.

WooCommerce admin bar and dashboard access

Do you wonder why some users at WooCommerce enabled site have access to the top admin bar and WordPress admin dashboard, but some users don’t?

It is by design: WooCommerce plugin developers decided for us for whom they allow access to WordPress admin dashboard and for whom they prohibit it. But thanks them for the professionalism – it is possible to change that default WooCommerce logic via special filters.

Garagulya, V., (2015) Woocommerce Admin Bar Access

Code used.

@dianjuar
dianjuar / fix-circleci-repo-ref.sh
Created January 29, 2019 18:28
When you want to integrate circleCI with sonarqube pull-request analysis, there is no reference to the branch that you want. This scripts fix that
# Fix circleci repo reference
# https://community.sonarsource.com/t/code-is-empty-on-pull-request-reviews/822/11
mkdir -p /root/.ssh;
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' > /root/.ssh/known_hosts;
git fetch --all;
git branch -D master;
git rev-parse origin/master;

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@dianjuar
dianjuar / catch-web-states.md
Last active April 18, 2019 17:26
A snippet to know how to catch states of your pages. Hovers, toasters, anything very hard to inspect

Open your web console and execute the snippet and wait to be executed then inspect the element

var timeToBeExecuted = 1000;
setTimeout(() => {
	debugger;
}, timeToBeExecuted);
@dianjuar
dianjuar / log.js
Last active June 10, 2019 23:07
Simple log function for nodejs
const logPrefix = ' --- ';
const colors = {
reset: '\x1b[0m',
bright: '\x1b[1m',
dim: '\x1b[2m',
underscore: '\x1b[4m',
blink: '\x1b[5m',
reverse: '\x1b[7m',
hidden: '\x1b[8m',
@dianjuar
dianjuar / dockerized-mongo.md
Last active September 10, 2019 20:40
Dockerized Mongo DB environment

Dockerized MongoDB environemnt

A quick an simple dockerized Mongo DB setup

Set up

  1. Create this docker-file in your project.
# Use root/example as user/password credentials
@dianjuar
dianjuar / my-extensions-angular-env.md
Created December 3, 2019 15:55
The Vs Code Extensions that I use in an Angular Environment
Name Link Description
Angular 8 Snippets - TypeScript, Html, Angular Material, ngRx, RxJS & Flex Layout [![L
@dianjuar
dianjuar / run scrapy spider on python script.md
Last active September 9, 2020 07:41
function to run a scrapy crawler on python script

Run a Scrapy spider on script

import scrapy

#--run a crawler in a script stuff
from pydispatch             import dispatcher
from scrapy                 import signals
from scrapy.crawler         import CrawlerProcess
from pydispatch             import dispatcher
@dianjuar
dianjuar / develop-master-differences.md
Created September 14, 2020 21:03
See the commit differences between develop and master

To see the commit differences between develop and master

git checkout master && git pull && git checkout develop && git pull && git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative master..develop

Useful to know what is going to be deployed