Skip to content

Instantly share code, notes, and snippets.

View lagden's full-sized avatar
🎯
Focusing

Thiago Magalhães lagden

🎯
Focusing
  • São Paulo
  • 20:39 (UTC -03:00)
View GitHub Profile
@lagden
lagden / pkg-cli.js
Last active January 20, 2021 14:01
Update all dependencies and devDependencies to latest version in package.json
#!/usr/bin/env node
'use strict'
const {resolve} = require('path')
const {createWriteStream} = require('fs')
const {promisify} = require('util')
const child_process = require('child_process')
const exec = promisify(child_process.exec)
@lagden
lagden / a.mjs
Created August 3, 2018 20:00
ECMAScript Modules (import/export)
const a = 'a'
export default a
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Agrega</title>
<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1">
<link href="./agrega/main.css" rel="stylesheet" type="text/css">
<!-- Folha de estilo do iframe do Nimble + FormAgrega -->
<style>
@lagden
lagden / data.sql
Last active November 28, 2017 03:51
Using mysql module
-- MySQL dump 10.13 Distrib 5.7.16, for osx10.11 (x86_64)
--
-- Host: localhost Database: consulta_veiculo
-- ------------------------------------------------------
-- Server version 5.7.16
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@lagden
lagden / TypeScript+RxJS+Closure.md
Created August 22, 2017 06:14
TypeScript + RxJS + Closure Compiler setup

I'm just going to make a note of this for Future Paul, because I spent way too long trying to get this working. If anyone has a better version of this workflow let me know.

Here's the rough idea:

  1. Have some TypeScript
  2. With some RxJS. Only include the bits of RxJS that we actually need because bundle sizes.
  3. Combine to a bundle using Closure Compiler (because it's super good at crushing down JS).

Because Future Paul will want it, here's the installs needed:

@lagden
lagden / counter-mobx-react.js
Created January 21, 2017 01:56
Test react mobx state animation
import React, {Component} from 'react'
import {render} from 'react-dom'
import {TweenMax, Linear} from 'gsap'
import RoundPropsPlugin from 'gsap/RoundPropsPlugin'
import {observable, action, useStrict} from 'mobx'
import {observer} from 'mobx-react'
import DevTools from 'mobx-react-devtools'
useStrict(true)
@lagden
lagden / server.js
Created November 10, 2016 06:23
Puro Server - Node.js
'use strict'
const fs = require('fs')
const path = require('path')
const http = require('http')
const url = require('url')
const crypto = require('crypto')
const mimeTypes = require('mime-types')
const debug = require('debug')
@lagden
lagden / index.jade
Created August 10, 2016 15:44
Switch
.switchSlide
input.switchSlide__radio-0#concessionaria_0(name='concessionaria' type='radio' value='0' required)
input.switchSlide__radio-1#concessionaria_1(name='concessionaria' type='radio' value='1' required)
ul.switchSlide__widget
li.switchSlide__opt.switchSlide__opt-0
label(for='concessionaria_0') Não
li.switchSlide__opt.switchSlide__opt-1
label(for='concessionaria_1') Sim
.switchSlide
@lagden
lagden / for1.js
Last active August 1, 2016 20:56
Benchmark cache length
function for1() {
'use strict';
const a = [];
for (let i = 0; i < 9999999; i++) {
a.push(i);
}
console.time('loop');
for (let c = 0; c < 1e3; c++) {
<svg preserveAspectRatio="xMinYMin" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 560 1388">
<defs>
<mask id="canTopMask">
<image width="560" height="1388" xlink:href="img/can-top-alpha.png"></image>
</mask>
</defs>
<image mask="url(#canTopMask)" id="canTop" width="560" height="1388" xlink:href="can-top.jpg"></image>
</svg>