Skip to content

Instantly share code, notes, and snippets.

Michael Nagy michaelnagy

Block or report user

Report or block michaelnagy

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
@michaelnagy
michaelnagy / server.js
Created Jun 5, 2018
proxy-server-nodejs
View server.js
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 Apr 9, 2018
Jsconfig.json file for VSCode with styled-components support
View jsconfig.json
{
"compilerOptions": {
"plugins": [
{
"name": "typescript-styled-plugin"
}
],
"baseUrl": "./",
"paths": {
"app/*": ["src/*"]
@michaelnagy
michaelnagy / orderListByDate.js
Created Jan 16, 2018
Redux Reselect selector to sort an array by date
View orderListByDate.js
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
View HotDeals.css
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;
View HotDeals.jsx
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';
View 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 Aug 6, 2017
The full component for RenderPicker
View RenderPicker.jsx
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'
}
}
View Form.jsx
// Stateless component to use inside the form
const RenderField = ({
input,
placeholder,
type,
meta: { touched, error }
}) => {
return (
<div style={{ width: '100%' }}>
{touched && error ?
View history_function.jsx
let radio = []
for (var prop in allusers) {
let i = 0
if (allusers[prop].oid === uid ) {
radio[i] =
<TableRow>
<TableRowColumn style={ajusteA}>{allusers[prop].date}</TableRowColumn>
<TableRowColumn>{allusers[prop].message}</TableRowColumn>
<TableRowColumn>{allusers[prop].type}</TableRowColumn>
@michaelnagy
michaelnagy / hasEmptyProperty.js
Created Jun 28, 2017
Check if an object has empty properties and return the first empty property
View hasEmptyProperty.js
function hasEmptyProperty(values) {
for (var key in values) {
return true && key
}
}
You can’t perform that action at this time.