Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Thiago Lagden lagden

View GitHub Profile
@lagden
lagden / a.mjs
Created Aug 3, 2018
ECMAScript Modules (import/export)
View a.mjs
const a = 'a'
export default a
View index.html
<!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 Nov 28, 2017
Using mysql module
View data.sql
-- 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 Aug 22, 2017 — forked from paullewis/TypeScript+RxJS+Closure.md
TypeScript + RxJS + Closure Compiler setup
View TypeScript+RxJS+Closure.md

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 Jan 21, 2017
Test react mobx state animation
View counter-mobx-react.js
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 Nov 10, 2016
Puro Server - Node.js
View server.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')
View index.jade
.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 Aug 1, 2016
Benchmark cache length
View for1.js
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++) {
View gist:522be64213455c25ceaf
<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>
@lagden
lagden / qs.js
Created Jun 29, 2015
query string to javascript object
View qs.js
/* globals console */
'use strict';
function parseQS(str) {
var strArr = String(str)
.replace(/^&/, '')
.replace(/&$/, '')
.split('&');
var sal = strArr.length;
var i;
You can’t perform that action at this time.