Skip to content

Instantly share code, notes, and snippets.

View kcmr's full-sized avatar

Kus Cámara kcmr

View GitHub Profile
@kcmr
kcmr / logger.js
Created March 12, 2024 12:29
Simple console logger with color
export const logger = (function logger() {
const red = (text) => `\u001B[31m${text}\u001B[0m`
const yellow = (text) => `\u001B[33m${text}\u001B[0m`
const green = (text) => `\u001B[32m${text}\u001B[0m`
function mapConsoleArgumentsWithColor(method, color) {
return function (...arguments_) {
console[method](...arguments_.map((t) => color(t)))
}
}
@kcmr
kcmr / frontendmasters-lesson-durations.js
Last active April 21, 2022 22:42
Shows the duration of lessons in FrontendMasters in minutes and seconds and the total duration of a section. Can be used as a Chrome snippet.
const BASE_DATE = new Date();
function setLessonsDuration() {
let currentGroupTitle;
let totalTime = 0;
Array.from(document.querySelectorAll('nav .FMPlayerScrolling li')).forEach(
(item) => {
if (item.matches('.lesson-group')) {
currentGroupTitle = item;
-import { css } from 'lit-element';
+import { css } from 'lit';
-import { LitElement, html, property as foo, customElement } from 'lit-element';
+import { LitElement, html } from 'lit';
+import { property as foo, customElement } from 'lit/decorators.js';
-import { repeat } from 'lit-html/directives/repeat.js';
+import { repeat } from 'lit/directives/repeat.js';
-import { ifDefined } from 'lit-html/directives/if-defined';
+import { ifDefined } from 'lit/directives/if-defined';
@kcmr
kcmr / Hyper Dark Material.tmTheme
Created May 31, 2020 10:37
Port of Hyper Dark Material for VS Code for Sublime Text
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Hyper Dark Material</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@kcmr
kcmr / rename-element-to-polymerelement.js
Last active December 28, 2019 23:07
Codemod to replace the first block scope in a file by a IIFE
export default function(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.VariableDeclarator, {
id: {
type: 'Identifier',
name: 'Element',
},
})
{
"paddingVertical":"56px",
"paddingHorizontal":"56px",
"backgroundImage":null,
"backgroundImageSelection":null,
"backgroundMode":"color",
"backgroundColor":"rgba(255,255,255,0)",
"dropShadow":true,
"dropShadowOffsetY":"10px",
"dropShadowBlurRadius":"21px",
@kcmr
kcmr / rollup.config.js
Created June 16, 2019 23:07
Rollup config to transpile LitElement without the need to use custom-es5-adapter
import commonjs from 'rollup-plugin-commonjs';
import resolver from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import multiEntry from 'rollup-plugin-multi-entry';
export default {
input: [
require.resolve('regenerator-runtime'),
'src/my-component/component.js'
],
'use strict';
const browserSync = require('browser-sync').create();
const portfinder = require('portfinder');
const {spawn} = require('child_process');
const COMPONENT_PATH = process.env.npm_package_name;
const browserSyncConfig = {
open: false,
notify: false,

Esto es un gist de prueba.

module.exports.onCreateNode = ({ node, actions }) => {
  const { createNodeField } = actions

  if (node.internal.type === 'MarkdownRemark') {
    const slug = path.basename(node.fileAbsolutePath, '.md')

 createNodeField({
@kcmr
kcmr / travis.yml
Created January 9, 2019 01:27
CI/CD con Travis en Github (Medium post)
language: node_js
node_js: "8"
addons:
chrome: stable
install:
- npm install
- npm install -g codecov