Skip to content

Instantly share code, notes, and snippets.

View Asinox's full-sized avatar
💭
React + Cinema = App!

Juan Miguel Calcaño Asinox

💭
React + Cinema = App!
View GitHub Profile
@agneym
agneym / Coffee.js
Created February 14, 2020 15:10
Buy me a Coffee with React and Styled Components
import React from 'react';
import styled from 'styled-components';
const Button = styled.a`
line-height: 2;
height: 5rem;
text-decoration: none;
display:inline-flex;
color: #FFFFFF;
background-color: #FF813F;
@jamesreggio
jamesreggio / react-forwardref-simple-example.js
Last active January 8, 2023 21:40
Simple example usage of React.forwardRef()
// EmailInput wraps an HTML `input` and adds some app-specific styling.
const EmailInput = React.forwardRef((props, ref) => (
<input ref={ref} {...props} type="email" className="AppEmailInput" />
));
class App extends Component {
emailRef = React.createRef();
render() {
return (
@Godofbrowser
Godofbrowser / axios.refresh_token.1.js
Last active July 8, 2024 15:43 — forked from culttm/axios.refresh_token.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
@Fabricio20
Fabricio20 / ReadMe.md
Last active November 7, 2023 04:37
Docker - Nginx + PHP FPM + MariaDB + PhpMyAdmin

Docker

This is a docker-compose template for a lemp stack.

Make sure to change both the root password under the mysql service, and the absolute URI on the phpmyadmin container.
You can also expose phpMyAdmin locally instead of remotely by properly configuring the ports.

Default locations:
(Original) -> (Your server)
/var/www/html -> ./webroot
/etc/nginx -> ./nginx

@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active March 13, 2024 10:59
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@mahmudahsan
mahmudahsan / ios_detect.swift
Last active July 9, 2021 09:07
iPhone X and other iOS device detection by Swift and Objective-C
struct Device {
// iDevice detection code
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad
static let IS_IPHONE = UIDevice.current.userInterfaceIdiom == .phone
static let IS_RETINA = UIScreen.main.scale >= 2.0
static let SCREEN_WIDTH = Int(UIScreen.main.bounds.size.width)
static let SCREEN_HEIGHT = Int(UIScreen.main.bounds.size.height)
static let SCREEN_MAX_LENGTH = Int( max(SCREEN_WIDTH, SCREEN_HEIGHT) )
static let SCREEN_MIN_LENGTH = Int( min(SCREEN_WIDTH, SCREEN_HEIGHT) )
@maotora
maotora / DeviceForm.js
Created September 2, 2017 09:26
Intergrating native-base styled components & redux-form.
import React, { Component } from 'react';
import { Grid, Col, Row } from 'react-native-easy-grid';
import * as renders from './renderedComponents';
import { Field, reduxForm } from 'redux-form';
import normalizePhone from './normalizePhone';
import { createRouter, withNavigation } from '@exponent/ex-navigation';
import {
Container,
Header,
Title,
@daftspunk
daftspunk / ajax-file-upload.htm
Created July 29, 2017 07:52
Sample AJAX file upload via October CMS
title = "AJAX File Upload"
url = "/test"
layout = "default"
is_hidden = 0
==
<?php
use System\Models\File;
function onSubmit()
{
@tesarwijaya
tesarwijaya / request.js
Created July 17, 2017 04:32
How to get a new token after token expired in axios
import axios from 'axios'
import store from '../store'
import qs from 'qs'
export const http = axios.create({
baseURL: 'http://localhost:8000/api/',
header: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
@DejanEnspyra
DejanEnspyra / CameraHandler.swift
Last active September 12, 2023 11:00
Access iOS Camera and Photo Library with Swift 3. http://theappspace.com/swift-access-ios-camera-photo-library/
//
// CameraHandler.swift
// theappspace.com
//
// Created by Dejan Atanasov on 26/06/2017.
// Copyright © 2017 Dejan Atanasov. All rights reserved.
//
import Foundation
import UIKit