Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Coding

Samuel Martins samwx

💻
Coding
View GitHub Profile
View ReactComponent.jsx
function App(props) {
return (
<div className="App">
<h1>{props.title}</h1>
<h2>Start editing to see some magic happen!</h2>
</div>
);
}
@samwx
samwx / .zshrc
Created Oct 22, 2019
Create a folder and enter it
View .zshrc
function mkd() {
mkdir -p "$@" && cd "$_";
}
View data.json
{"v":"5.5.9","fr":25,"ip":0,"op":45,"w":300,"h":265,"nm":"Convidar-membros","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"tampa carta/letter-animation contornos","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":6,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":8,"s":[90]},{"t":11,"s":[100]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[306.993,105.5,0],"ix":2},"a":{"a":0,"k":[101.75,86.75,0],"ix":1},"s":{"a":0,"k":[-102.023,-107.067,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.215,-5.515],[0,0],[-4.602,0],[0,0],[-3.093,2.92],[0,0]],"o":[[0,0],[3.092,2.92],[0,0],[4.602,0],[0,0],[-6.211,-5.515]],"v":[[-11.25,-38.938],[-100.833,39.713],[-88.982,44.453],[88.981,44.453],[100.833,39.713],[11.249,-38.938]],"c":true},"ix":2},"nm":"Caminho 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.956862804936,0.831372608858,0.490196108351,1],"i
@samwx
samwx / Products.js
Last active Sep 3, 2019
Products API
View Products.js
import products from "./products-data.json";
export class Products {
static getProducts() {
return new Promise((resolve, reject) => {
if (products) {
resolve(products);
} else {
reject();
}
@samwx
samwx / Component.js
Created Aug 3, 2019
application-choices-criterias
View Component.js
Vue.component('my-component', {
props: ['title', 'body'],
template: '<h1>Hello World</h1>'
})
/**
* <my-component></my-component>
**/
@samwx
samwx / decorator-1.ts
Last active Jul 6, 2019
Typescript examples
View decorator-1.ts
function SelfDriving(classFn: Function) {
classFn.prototype.selfDrivable = true;
}
@SelfDriving
class SomeCar {
private make: string;
constructor(make: string) {
this.make = make;
}
@samwx
samwx / event-receiver.ts
Last active Jun 14, 2019
Micro frontend presentation
View event-receiver.ts
init(): void {
this.handleOnReceiveMessage = this.onReceiveMessage.bind(this)
window.addEventListener('message', this.handleOnReceiveMessage)
}
onReceiveMessage(message: MessageEvent) {
const action = message.data
switch(action) {
case 'a':
@samwx
samwx / ReactChannels.jsx
Created Jan 15, 2019
Example using react with channels
View ReactChannels.jsx
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Channel from '@nodeguy/channel'
const ch = Channel()
export class Generators {
static async waitAndRetrieve() {
const r = await ch.shift()
@samwx
samwx / tslint.json
Created Sep 25, 2018
Node typescript lint file
View tslint.json
{
"extends": [
"tslint:latest",
"tslint-config-prettier"
],
"rules": {
"no-any": false,
"ordered-imports": false,
"semicolon": [true, "always"],
"member-ordering": [
@samwx
samwx / .travis.yml
Created Sep 25, 2018
Travis file for typescript projects with Jest and coveralls
View .travis.yml
language: node_js
node_js:
- 'node' # use latest stable nodejs version
before_script:
- npm install
- npm run test
- npm run coverage
script:
- npm run build # jest test with coverage flag does coverage too
after_script:
You can’t perform that action at this time.