Skip to content

Instantly share code, notes, and snippets.

View henricavalcante's full-sized avatar
🏠
Working from home

Henri Cavalcante henricavalcante

🏠
Working from home
View GitHub Profile
@henricavalcante
henricavalcante / .bash_profile
Created January 23, 2015 20:12
Bash scripts
export GREP_OPTIONS="--color=auto"
export GREP_COLOR="4;33"
export CLICOLOR="auto"
alias ls="ls -G"
alias ll="ls -l"
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
// Código com JSX
var HelloMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
React.render(<HelloMessage name="John" />, mountNode);
@henricavalcante
henricavalcante / 01angular.html
Last active August 29, 2015 14:18
Testes de Performance entre React e Angular
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="node_modules/angular/angular.min.js"></script>
<style type="text/css">
li {
display: none;
}
li:first-child {
display:block;
<!DOCTYPE html>
<html>
<head>
<!-- The core React library -->
<script src="http://fb.me/react-0.13.1.js"></script>
<!-- In-browser JSX transformer, remove when pre-compiling JSX. -->
<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
</head>
<body>
@henricavalcante
henricavalcante / adap.html
Created April 10, 2015 12:36
access content inside iframe
<html>
<head>
<title></title>
</head>
<body>
<iframe id="teste" src="http://wilivro.adaptativa.com.br/educational_platform/dashboard"></iframe>
<script type="text/javascript">
setTimeout(function() {
console.log(document.getElementById('teste').contentWindow.$('.module-bg.quiz').next('.module-button').attr('href'));
}, 1000);//como falei. não funciona.
@henricavalcante
henricavalcante / gist:f3b3f628999c3d6ae1dc
Last active August 29, 2015 14:18
MONGODB - Criação de Indices
> db.tests.createIndex({a:1, b:1}); //A criação de indice pode ser simples ou composta
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.tests.createIndex({a:-1}); //Ao passar o parametro negativo o índice é para ordem decrescente
{
"createdCollectionAutomatically" : false,
> db.tests.explain().find({a:1});
{
"queryPlanner" : { // Informações do Explain
"plannerVersion" : 1,
"namespace" : "tests.tests",
"indexFilterSet" : false,
"parsedQuery" : {
"a" : {
"$eq" : 1
}
@henricavalcante
henricavalcante / gist:b4e3da0555cb1c791256
Last active August 29, 2015 14:18
MONGODB - Ativando o profile
$ mongod --profile 1 --slowms 2
@henricavalcante
henricavalcante / gist:312c02e2ed555f313685
Created April 10, 2015 20:39
MONGODB - Profiling - Consultas com mais de 500ms
db.system.profile.find({millis:{$gt:500}}).sort({ts:-1})
$ mongotop 3
ns total read write 2015-04-10T18:00:42-03:00
test.tests 196ms 0ms 196ms
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms