Skip to content

Instantly share code, notes, and snippets.

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

fredsced

🏠
Working from home
View GitHub Profile
_makeConversionAjaxCall(data, successCallback, failureCallback) {
var originCurrency = this.state.originCurrency;
var destCurrency = this.state.destinationCurrency;
var payload = {
originAmount: data.newValue || this.state.originAmount,
destAmount: data.newValue || this.state.destAmount,
originCurrency: originCurrency,
destCurrency: destCurrency,
calcOriginAmount: false
@fredsced
fredsced / api.js
Created April 26, 2019 20:14
JWT authentication handler using Axios interceptors. It refreshes access token on the fly when backend API throws out a 401 error. Multiple requests at the same time supported.
import axios from 'axios';
import JWTDecode from 'jwt-decode';
import { AuthApi } from './auth.api';
import { config } from '../config';
const { API_ENDPOINT } = config[process.env.NODE_ENV];
axios.defaults.baseURL = API_ENDPOINT;
axios.defaults.timeout = 7000;
@fredsced
fredsced / index.html
Created March 1, 2019 10:42
Test materialize
<div class="container">
<div class="card-panel hoverable teal lighten-3 white-text center-align">Nombre de simploniens passés par la Prod:<span class="center" style="font-size:2em"> 46</span></div>
<div class="row">
<div class="col s12 l4 card-panel promo">
<p>Promo Content 1 goes here</p>
</div>
<div class="col s12 l4 card-panel promo">
<p>Promo Content 2 goes here</p>
</div>
@fredsced
fredsced / jdbc2oracle.java
Last active December 18, 2018 21:40
Using Java JDBC to connect to Oracle
public class OracleJdbcTest
{
String driverClass = "oracle.jdbc.driver.OracleDriver";
Connection con;
public void init(FileInputStream fs) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
{
Properties props = new Properties();
props.load(fs);