Skip to content

Instantly share code, notes, and snippets.

View sinner's full-sized avatar
:electron:
Crafting

José Gabriel González Pérez sinner

:electron:
Crafting
View GitHub Profile
@sinner
sinner / ApiRequest.js
Created April 16, 2021 20:18
Axios Wrapper
import axios from 'axios';
import get from 'lodash/get';
const API_BASE_URL = process.env.VUE_APP_API_BASE_URL
const ENV = process.env.NODE_ENV;
export class ApiRequest {
constructor(baseUrl = null) {
this.baseURL = baseUrl || API_BASE_URL;
this.clientRequestId = `DV-UI-${ENV}-${new Date().getTime()}`;
@sinner
sinner / dockercompose.yaml
Created December 5, 2019 14:02
Relational DB Platform Docker
# Use postgres/example user/password credentials
version: '2.2'
networks:
app-net:
driver: bridge
services:
db:
image: postgres:latest
@sinner
sinner / custom-utils.module.js
Created October 5, 2017 17:38
Using $http and httpInterceptors in Angular.js.
'use strict';
(function () {
angular.module('custom-utils', []);
})();
@sinner
sinner / CustomEntity.php
Last active June 14, 2021 10:44
Custom Validator Symfony Sample
<?php
use AppBundle\Validator\Constraints as AppAssert;
//...
/**
* @var string jsonArray
*
* @AppAssert\ContainsJsonFormat()
@sinner
sinner / intercom.io.html.twig
Created July 28, 2016 23:43
Code for stablish the communication between a Symfony App and Intercom.io marketing automation tool
<script>
{% if app.user %}
window.intercomSettings = {
app_id: "<yourAppCode>",
name: "{{ app.user.contact.firstName ~ ' ' ~ app.user.contact.lastName }}",
email: "{{ app.user.email }}",
created_at: {{ app.user.createdAt | date('U') }}
};
{% else %}
window.intercomSettings = {
@sinner
sinner / index.php
Created June 12, 2016 20:44
Index for LAMP
<?php
//var/www/index.php
$phpVersion = phpversion();
$apacheVersion = apache_get_version();
$mysqlVersion = "10.0.5-MariaDB";
$lampserverVersion = "";
// repertoires gnorer dans les projets
$projectsListIgnore = array ('.','..');
@sinner
sinner / numMasPopular
Created February 26, 2016 05:26
Devuelve el menor numero con mayor cantidad de apariciones en un array
function numMasPopular(arrayNumbers, size){
if(arrayNumbers.length!=size){
return 'Error: el tamaño del array no coincide con el indicado';
}
if(size==1){
return arrayNumbers[0];
}
var numbersGrouped = {};
var arrayNumbersGrouped = [];
var actualNumber = null;
@sinner
sinner / index.html
Created January 25, 2016 06:02
Making focus on text with Angularjs
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script data-require="angular.js@1.2.0-rc2" data-semver="1.2.0-rc2" src="http://code.angularjs.org/1.2.0-rc.2/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="MainCtrl">
@sinner
sinner / better-nodejs-require-paths.md
Created December 20, 2015 23:08 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions