Skip to content

Instantly share code, notes, and snippets.

View vspedr's full-sized avatar

Victor vspedr

  • Campinas, Brazil
View GitHub Profile
class ProgrammaticallyTextFilter extends React.Component {
/* There're two way that you can filter data */
handleBtnClick = () => {
this.refs.nameCol.applyFilter('Item name 3');
}
/* This is also work for filtering */
handleBtnClick1 = () => {
this.refs.table.handleFilterData({ name: 'Item name 3' });
@nuxlli
nuxlli / README.md
Created July 14, 2016 18:19
Testing `react-native` applications

Sobre

Não é simples fazer testes de aplicações react-native no device, por isso a maior parte das pessoas preferem testar separadamente os componentes (test unitários) usando o node.js e usar outras ferramentas para test de integração.

Dessa forma os testes unitários são como qualquer outro teste node.js. Você é livre para usar qualquer framework de testes, apesar da documentação oficial recomendar o uso do jest.

Pontos chave

  • Referências: Por se tratar de uma tecnologia em franca fase de desenvolvimento, muitas das referências para react-native estão desatualizadas ou imprecisas. Tome bastante cuidado principalmente no que se refere a syntax de ES5 e ES6;
@matthewriley
matthewriley / Git290onRHEL7x.md
Created June 15, 2016 18:59
Install Git 2.9.0 from source on RHEL 7.x

Install Git 2.9.0 from source on RHEL 7.x

These are the Terminal commands I recently used (June 2016) to install Git 2.9.0 from source on RHEL 7.x. I ran this in a VirtualBox VM after a fresh install from the ISO.

You mileage will vary as the yum packages are updated over time. The yum install line below should include all the dependencies, at least it did for me. Depending upon how often you use yum update you may need to run yum --enablerepo=base clean metadata as su before you run the following commands.

cd ~/Downloads
su
yum install autoconf cpio curl-devel expat-devel gcc gettext-devel make openssl-devel perl-ExtUtils-MakeMaker zlib-devel
wget -O v2.9.0.tar.gz https://github.com/git/git/archive/v2.9.0.tar.gz

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages
@herrfugbaum
herrfugbaum / random-pastel-rgba.js
Created March 11, 2016 10:09
Return a random pastel rgba color.
/* @param alpha boolean
* if true a random value for the alpha channel is calculated, else alpha channel = 1 (full saturation)
*/
var randomPastelColor = function (alpha) {
var rndm = function (f) { return Math.floor(Math.random() * f)},
pstlfy = function (p) { return Math.round((p + 255) / 2)},
r = pstlfy(rndm(256)),
g = pstlfy(rndm(256)),
b = pstlfy(rndm(256)),
a = alpha ? rndm(11) / 10 : 1
@delemach
delemach / slackNotify.js
Last active November 1, 2018 18:41 — forked from turret-io/slackNotify.js
Parse SNS notification from Elastic Beanstalk and publish to Slack channel
var http = require('https');
var querystring = require('querystring');
// set the post request options
var reqOptions = {
hostname: 'hooks.slack.com',
port: 443,
path: '/services/YOUR/SLACK/HOOK_HERE',
method: 'POST'
};
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@nhagen
nhagen / PromisAllWithFails.js
Last active November 15, 2022 18:11
Wait until all promises have completed even when some reject, with Promise.all
var a = ["sdfdf", "http://oooooolol"],
handleNetErr = function(e) { return e };
Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr))
.then(function(sdf, invalid) {
console.log(sdf, invalid) // [Response, TypeError]
})
.catch(function(err) {
console.log(err);
})