Skip to content

Instantly share code, notes, and snippets.

View davidtorroija's full-sized avatar
🏠
Working from home

David davidtorroija

🏠
Working from home
View GitHub Profile
@davidtorroija
davidtorroija / gulpfile.js
Last active September 13, 2022 20:23
a task that I created in using gulp to easily change rem sizes based on 10px to 16px, this loop all the css and scss files and updates the measures using a regular expression, it works with calc, with 0.x .x etc
var replace = require('gulp-replace');
var gulp = require('gulp');
var js = {
src: [
'src/**/*.scss',
'src/**/*.css',
'src/**/*.tsx', //for the tsx files is in beta because it's including some strings like .remove or lorem ipsum, we need to tweak more the regexto exclude those
],
};
import React from 'react';
import Spinner from './Spinner';
const Card = ({ loadingData, showData, weather, forecast }) => {
const today = new Date();
const day = today.getDate();
const month = today.getMonth() + 1;
const year = today.getFullYear();
const date = `${day} / ${month} / ${year} `;
@davidtorroija
davidtorroija / webpack-craco-config.js
Created July 14, 2022 15:10
craco config for wepback typescript create react app
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { addBeforeLoader, loaderByName } = require("@craco/craco");
// eslint-disable-next-line @typescript-eslint/no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require("path");
module.exports = {
devServer: (devServerConfig) => {
devServerConfig.writeToDisk = true;
return devServerConfig;
@davidtorroija
davidtorroija / jest.config.js
Created February 15, 2022 16:45
jest config
module.exports = {
moduleFileExtensions: [
"js",
"json",
// tell Jest to handle `*.vue` files
"vue",
],
transform: {
// process `*.vue` files with `vue-jest`
"^.+\\.vue$": "vue-jest",
@davidtorroija
davidtorroija / webpack config for karma.js
Created February 15, 2022 16:43
webpack config for karma
const { resolve } = require("path");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { getIfUtils, removeEmpty } = require("webpack-config-utils");
const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
const config = require("./config");
const rootResolve = path => resolve(__dirname, path);
const { ifProduction, ifNotProduction, ifDevelopment /*, ifTesting */ } = getIfUtils(process.env.NODE_ENV, [
"production",

Keybase proof

I hereby claim:

  • I am davidtorroija on github.
  • I am davidtorroija (https://keybase.io/davidtorroija) on keybase.
  • I have a public key ASCYPBZVc1_aSpt6PMRh2Jee6CUQQb4mjRFHix_JgKrfpQo

To claim this, I am signing this object:

@davidtorroija
davidtorroija / bounding_box_fabricjs.js
Created September 26, 2016 15:53 — forked from gregtap/bounding_box_fabricjs.js
Get bounding box off all objects on a fabric canvas
getBoardBoundingBox: function(canvas) {
var minX = Number.MAX_VALUE;
var maxX = Number.MIN_VALUE;
var minY = Number.MAX_VALUE;
var maxY = Number.MIN_VALUE;
canvas.forEachObject(function(o){
var rad = o.angle * Math.PI/180;
var w = o.width * o.scaleX;
Reveal.prototype.resize = function(canvas) {
var _this, challengeToolsDiv, container, footerHeight, headerHeight, height, init_height, init_ratio, init_width, objects, ratio, ref, resize_height, resize_width, scaleX, scaleY, toolsDiv, toolsHeight, width;
_this = this;
init_width = this.init_width;
init_height = this.init_height;
init_ratio = init_width / init_height;
container = $('#widget-container');
resize_width = false;
resize_height = false;
width = container.find('.main')[0].clientWidth;
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<meta charset="utf-8" />
<title>videojs-overlay Demo</title>
<link href="https://vjs.zencdn.net/5-unsafe/video-js.css" rel="stylesheet" />
...
</head>
<body>
{
"name": "",
"version": "1.0.0",
"description": "",
"homepage": "https://github.com/",
"repository": {
"type": "git",
"url": "git+https://github.com/pepe.git"
},
"//": [],