Skip to content

Instantly share code, notes, and snippets.

RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use app.html
RewriteRule ^ /app.html
// Post.js
export default class Post {
constructor(data) {
this.id = data.id
this.title = data.title
this.body = data.body
}
}
// PostCtrl.js

Resources

The Meteor Guide

The Meteor Guide is an official guide meant to give Meteor users a more broad view on what the best practices and conventions in the community are. As Meteor is a non-opinionated framework in terms of architecture, this is a valuable resource every Meteor developer must read.

Meteor forums

https://forums.meteor.com/

Blogs

import React from 'react';
import { shallow, mount } from 'enzyme';
import Checkbox from 'components/Form/Checkbox';
import expect from 'expect';
import 'jsdom-global/register';
describe('<Checkbox />', () => {
it('adds checked attribute to input', () => {
const wrapper = shallow(<Checkbox checked />);
const input = wrapper.find('input');
/* eslint-disable no-var */
var webpack = require('webpack');
var cssnano = require('cssnano');
var path = require('path');
var config = {
entry: {
app: './src/index'
},
output: {
/* eslint-disable no-var */
var merge = require('webpack-merge');
var baseConfig = require('./webpack.config.base');
var Dashboard = require('webpack-dashboard');
var DashboardPlugin = require('webpack-dashboard/plugin');
var dashboard = new Dashboard();
var devConfig = {
plugins: [
/* eslint-disable no-var */
var merge = require('webpack-merge');
var baseConfig = require('./webpack.config.base');
var prodConfig = {
module: {
loaders: [
{ test: /\.svg$/, loaders: ['url-loader?limit=100000', 'image-webpack'] }
]
}
{
"scripts": {
"start": "webpack-dev-server --config webpack.config.dev.js",
"build-prod": "NODE_ENV=production webpack -p --config webpack.config.prod.js"
}
}

URL: https://www.youtube.com/watch?v=NGxVLnJKhP8

La charla explica cómo funciona internamente React con el objetivo de entender cómo y por qué ciertas optimizaciones de performance funcionan.

shouldComponentUpdate puede no funcionar bien sin inmutabilidad, porque necesitás hacer un deep equal lo cual puede ser muy costoso, y un simple === no va a funcionar porque tanto this.state.key y nextProps.key referencian a la misma instancia del objeto. Con datos inmutables, cada uno referenciaría a una nueva instancia por lo cual un === funcionaría.

usar setState() o connect() en los children puede tener un impacto en la performance. En el caso de un List cuyos hijos son varios Item, en lugar de pedir la data de los items en la lista, se puede pasar el id y llamar a mapStateToProps en cada Item para evitar un recálculo en el elemento padre, que obliga a un recálculo en todos los elementos hijos.

@pechitook
pechitook / instabot.js
Created September 24, 2016 16:25
Instagram scripts to automate common tasks
clickAndWait = (cb, ms = 2000) => {
setTimeout(cb, ms)
}
openFirstPhoto = () => {
document.querySelectorAll('._nljxa')[0].childNodes[0].childNodes[0].click()
}
likePhoto = () => {
document.querySelectorAll('.coreSpriteHeartOpen')[0].click()