Skip to content

Instantly share code, notes, and snippets.

View jqn's full-sized avatar

Joaquin Guardado jqn

View GitHub Profile
@jqn
jqn / RNCamera.jsx
Last active August 16, 2023 17:16
React Native Camera Example with hooks
import React, { useState, useRef, useEffect } from "react";
import {
StyleSheet,
Dimensions,
View,
Text,
TouchableOpacity,
SafeAreaView,
} from "react-native";
import { Camera } from "expo-camera";
@jqn
jqn / CameraRotatingIcons.jsx
Last active September 29, 2020 06:30
RN Camera with rotating icons
import React, {Component} from 'react';
import {View, TouchableOpacity, Dimensions, Text} from 'react-native';
import Orientation from 'react-native-orientation-locker';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import {RNCamera} from 'react-native-camera';
import * as Animatable from 'react-native-animatable';
const SCREEN_HEIGHT = Dimensions.get('window').height;
const SCREEN_WIDTH = Dimensions.get('window').width;
@jqn
jqn / install_pipenv.md
Created September 22, 2020 09:47 — forked from planetceres/install_pipenv.md
pipenv installation notes Ubuntu 18.04

Installation Notes for pipenv on Ubuntu 18.04

1. Add ~/.local/bin to PATH

pypa/pipenv#2122 (comment)

echo 'export PATH="${HOME}/.local/bin:$PATH"' >> ~/.bashrc
@jqn
jqn / .jsbeautifyrc
Created August 10, 2020 04:16 — forked from wzup/.jsbeautifyrc
.jsbeautifyrc file example
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"],
{"contents":{"editor":{"formatOnSave":true}},"overrides":[],"keys":["editor.formatOnSave"]}
@jqn
jqn / axiosError.js
Last active June 26, 2020 08:44
axios error handling
axios.get('/user/12345')
.catch(function (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log('data', error.response.data);
console.log('status', error.response.status);
console.log('headers', error.response.headers);
} else if (error.request) {
// The request was made but no response was received
@jqn
jqn / eslintrc.js
Last active June 26, 2020 11:23
React Native Eslint config
module.exports = {
root: true,
extends: '@react-native-community',
rules: {
'prettier/prettier': 0, // Disables prettier
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
'react/no-unused-state': 'error', // Checks for unused state properties
'react/no-did-mount-set-state': 'off',
'react-native/no-unused-styles': 2,
@jqn
jqn / README-Template.md
Created June 23, 2020 11:41 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@jqn
jqn / forms.py
Last active April 13, 2020 09:58
SuperTuber TutorUserSignUpForm
class TutorUserSignUpForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user', None)
super(TutorUserSignUpForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
profile = Profile.objects.get(pk=self.user.pk)
self.initial['firstname'] = profile.firstname
self.initial['lastname'] = profile.lastname
@jqn
jqn / views.py
Created April 7, 2020 16:20
super_tuber register as tutor
class TutorRegister(CreateView):
model = TUser
form_class = TutorUserSignUpForm
template_name = 'FindTutors/tutor_signup.html' # correct form HTML
def form_valid(self, form):
user = form.save(commit=False)
user.is_tutor = True
user.save()