Skip to content

Instantly share code, notes, and snippets.

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

Emanuel Quimper EQuimper

🏠
Working from home
View GitHub Profile
var normalFormat = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
var romanFormat = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];
function convertToRoman(num) {
if (num === 0) return '';
var value = '';
for (var i = 0; i < normalFormat.length; i++) {
@EQuimper
EQuimper / phoenix_heroku_reset_db.md
Created February 24, 2018 19:03 — forked from ventsislaf/phoenix_heroku_reset_db.md
Reset database on Heroku running Phoenix app

Note: Don't do this on a production evniroment!

Get the heroku database name:

heroku pg:info

Name can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337.

//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
let titleLabel = UILabel()
let captionLabel = UILabel()
let coverImageView = UIImageView()
let backgroundImageView = UIImageView()
@EQuimper
EQuimper / icons.js
Created January 18, 2018 21:07
Running Vector Icons for React-Native-Navigation
import React from 'react';
import Entypo from 'react-native-vector-icons/Entypo'
import { Platform, PixelRatio } from 'react-native';
const navIconSize = (__DEV__ === false && Platform.OS === 'android') ? PixelRatio.getPixelSizeForLayoutSize(25) : 25;
const replaceSuffixPattern = /--(active|big|small|very-big)/g;
const icons = {
home: [navIconSize, Entypo],
photos_list = [
"https://freestocks.org/fs/wp-content/uploads/2018/01/english_bulldog_lying_on_a_sofa_2-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2017/04/old_tile_stove_fire-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2017/10/trip_in_the_mountins_with_a_dog-733x1100.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/08/french_fries-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/09/memory_box_2-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/10/sailing_boat_at_sunset-450x300.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/11/playground_ropes-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2016/11/fig_cake_2-800x533.jpg",
"https://freestocks.org/fs/wp-content/uploads/2017/12/christmas_tree_decoration_3-800x533.jpg",
@EQuimper
EQuimper / uploadImage.ts
Last active May 25, 2021 14:38
Upload a image using presign url from s3 in React-Native
export async function uploadImage(method: string, url: string, file: any) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest()
xhr.open(method, url)
xhr.setRequestHeader('Content-Type', file.type)
xhr.onload = () => {
if (xhr.status !== 200) {
reject(
new Error(
`Request failed. Status: ${xhr.status}. Content: ${xhr.responseText}`
@EQuimper
EQuimper / isRootScreen.js
Created August 15, 2017 12:38
React-Navigation for know if the root screen. Let us manages back button android.
// @flow
export function isRootScreen(navigator: {
index: ?number,
routes: ?Array<Object>,
}) {
if (navigator.index == null) {
return true;
}
import { NavigationActions } from 'react-navigation';
import { normalize } from 'normalizr';
import { Feed, Photo } from '../utils/api';
import { arrayOfPhotos } from './normalizr_schema';
export const FETCH_FEED_IMAGES = 'FETCH_FEED_IMAGES';
export const FETCH_FEED_IMAGES_SUCCESS = 'FETCH_FEED_IMAGES_SUCCESS';
export const FETCH_FEED_IMAGES_ERROR = 'FETCH_FEED_IMAGES_ERROR';
// @flow
import React, { Component } from 'react';
import {
RefreshControl,
FlatList,
View,
ActivityIndicator,
} from 'react-native';
@EQuimper
EQuimper / .gitconfig
Created June 29, 2017 14:22
My .gitconfig
[user]
name = EQuimper
email = quimperemanuel@gmail.com
[alias]
c = commit -m
i = init
s = status
graph = log --graph --oneline --decorate=short --branches='*'
br = branch