Skip to content

Instantly share code, notes, and snippets.

Dhyego Calota dhyegocalota

Block or report user

Report or block dhyegocalota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View folder_structure.txt
.
├── README.md
├── app.json
├── package.json
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
├── src
│   ├── Config.js
View febraban_banks.js
console.log(JSON.stringify(Object.values(Array.from(document.querySelectorAll('table:nth-child(2) tbody tr')).filter((x, i) => i > 2).map(x => ({ code: x.querySelector('td:nth-child(1)').innerText.trim(), name: x.querySelector('td:nth-child(2)').innerText.trim() })).filter(x => x.code.length).reduce((acc, x) => { acc[x.code] = x; return acc }, {})), null, 2));
View highligh.sh
# Custom functions
function light() {
if [ -z "$2" ]
then src="pbpaste"
else
src="cat $2"
fi
$src | highlight -O rtf --syntax $1 --style solarized-light --font-size 18 | pbcopy
}
@dhyegocalota
dhyegocalota / picker.js
Created Apr 18, 2017
[React Native] Picker for Native Base + React Native Navigation (by Wix)
View picker.js
// @flow
import React, { Component } from 'react';
import {
connectStyle,
Container,
Content,
ListItem,
Text,
Radio,
@dhyegocalota
dhyegocalota / hackaflag.js
Created Mar 19, 2017
[Hackflag] Web server
View hackaflag.js
var wrongContent = 'nadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaaquinadaanadanadaaaannaannaanndnna';
var filesToTest = Array.from(document.querySelectorAll('td a')).filter(x => x.href.match(/\.php$/));
const testContent = (file) => {
return (response) => {
response.text()
.then(text => {
if (text.trim() != wrongContent) {
console.log(`O arquivo '${file.href}' tem o content: '${text}'`);
View migrate.sh
#!/bin/sh
error() { echo "$@" 1>&2; }
file=$1
if [ -z $file ]; then
error "Usage \`./migrate credentials.txt\`"
exit 1
fi
@dhyegocalota
dhyegocalota / unique_words.js
Created Jul 8, 2016
Unique Words (by line)
View unique_words.js
const fs = require('fs');
var data = [];
var file = fs.readFileSync(process.argv[2], {encoding: 'utf-8'});
file
.split('\n')
.forEach(x => {
if (data.indexOf(x) === -1) {
data.push(x);
View remotesetup.sh
#!/bin/sh
error() { echo "$@" 1>&2; }
domain_files=$1
if [ -z $domain_files ]; then
error "What is the file with the domains?"
exit 1
fi
View megasom-alpha3-products-report.js
// var products = [{ sku: 1 }, { sku: 2 }]; // Sample data (SKU of products from Magento Database)
var productsSku = products
.map(product => (product.sku || '').toString())
.map(sku => sku.split(' ').filter(node => node.match(/^\S+$/)))
.reduce((acc, target) => Array.prototype.concat.apply(acc, target))
.filter((value, index, self) => self.indexOf(value) === index)
.map(sku => `'${sku}'`)
.sort((x, y) => x - y)
.join(', ');
@dhyegocalota
dhyegocalota / pattern.txt
Created Apr 28, 2016
Helper to format tasks from excel (regex)
View pattern.txt
// CTRL+F
Match pattern: (.+)[\t\s]+([0-9]+\:[0-9]+\:[0-9]+)[\t\s]+(.+)
Replace pattern: [$2] $1 - $3
You can’t perform that action at this time.