Skip to content

Instantly share code, notes, and snippets.

View michaelnagy's full-sized avatar

Michael Nagy michaelnagy

  • https://traact.com
  • Ribeirao Preto - Brazil
View GitHub Profile
@michaelnagy
michaelnagy / blaze-notification-bot.js
Created March 16, 2022 22:24
Blaze crash game script to notify when a N number of below 2x games happen
const entries = document.querySelector(".entries")
const allGames = entries.children
function getGoodNodeIndex() {
const allGamesArr = Array.from(allGames)
const goodPosition = allGamesArr.findIndex((item) => {
return item.className === 'good'
})
return goodPosition
@michaelnagy
michaelnagy / compareTwoArrayOfObjects.js
Created October 13, 2020 20:23
Returns the matches of the second Array of objects compared to the first
const getMatchsBetween = (Arr1, Arr2, propertyToCompare) => {
const matchesFound = Arr2.filter((Arr2Item => {
const found = Arr1.find(Arr2Item => {
return Arr2Item === dia[propertyToCompare]
})
return found !== undefined
}))
console.log('------------------------------------');
console.log(matchesFound);
console.log('------------------------------------');
@michaelnagy
michaelnagy / server.js
Created June 5, 2018 01:14
proxy-server-nodejs
server.put('/auth/v1/alterar-senha', async (req, res) => {
console.log('TOKEN from server: ', req.cookies.access_token)
const response = await fetch('yourputurl.com', {
method: 'PUT',
headers: {
token: req.cookies.access_token,
authorization: 'Basic Q3asdasdasdbGllbnQ6ZW9CWDYxaWcasdasVaRHpH',
'content-type': 'application/json'
},
body: JSON.stringify({ nova: 'oldpass', antiga: 'newpass' })
@michaelnagy
michaelnagy / jsconfig.json
Last active April 9, 2018 15:29
Jsconfig.json file for VSCode with styled-components support
{
"compilerOptions": {
"plugins": [
{
"name": "typescript-styled-plugin"
}
],
"baseUrl": "./",
"paths": {
"app/*": ["src/*"]
@michaelnagy
michaelnagy / orderListByDate.js
Created January 16, 2018 16:55
Redux Reselect selector to sort an array by date
import { createSelector } from 'reselect';
import moment from 'moment';
export const orderListByDate = createSelector(state => {
return state.sort((a,b) => {
return moment.utc(b.startDate).diff(a.startDate);
})
},
// the final paramenter in the createSelector
// function must be a function that accepts as arguments
div.HotDeals.slider > div > div > div:first-child , div.HotDeals.slider > div > div > div:nth-child(3), div.HotDeals.slider > div > div > div > div > div > div {
background-color: orange !important;
}
span.HotDeals.cashback-value {
background-color: orange;
color:white;
padding: 10px 15px;
}
span.HotDeals.cashback-arrow-up {
width: 0;
import React, { Component } from 'react';
import Portal from '../templates/portal/Portal';
import LoadingContainer from '../shared/Loading';
import '../../theme/css/material-design-iconic-font.css';
import '../../theme/js/functions.js';
import '../../theme/css/styles.css';
import HotDealsListContainer from './HotDealsListContainer';
import HotDealsEditContainer from './HotDealsEditContainer';
import PropTypes from 'prop-types';
@michaelnagy
michaelnagy / Question.js
Created August 14, 2017 20:56
Question.js
import React from 'react';
import { Card, CardActions, CardHeader, CardText } from 'material-ui/Card';
import { SmileUp, SmileDown } from '../shared/svgIcons/icons';
import { PieChart, Pie, Sector, Cell } from 'recharts';
import Loading from './Loading'
import './QuestionContainer.css'
const data = [{ name: 'Group A', value: 400 }, { name: 'Group B', value: 800 }];
const COLORS = ['#F44336', '#0088FE'];
@michaelnagy
michaelnagy / RenderPicker.jsx
Created August 6, 2017 14:24
The full component for RenderPicker
import React from 'react'
import { View, StyleSheet, Text, Picker } from 'react-native';
class RenderPicker extends React.Component {
constructor(props) {
super(props)
this.state = {
value: 'Selecione'
}
}
// Stateless component to use inside the form
const RenderField = ({
input,
placeholder,
type,
meta: { touched, error }
}) => {
return (
<div style={{ width: '100%' }}>
{touched && error ?