Skip to content

Instantly share code, notes, and snippets.

View indie-rok's full-sized avatar
🏠
Working from home

Emmanuel Orozco indie-rok

🏠
Working from home
View GitHub Profile
@indie-rok
indie-rok / git_branch_naming.md
Last active July 12, 2018 16:04 — forked from revett/git_branch_naming.md
Git Branch Naming Conventions

<type>/<jira-ticket-id>

--

<type>

Should go in lowercase

bug    - Code changes linked to a known issue.
feature   - New feature.
hotfix - Quick fixes to the codebase.
junk   - Experiments (will never be merged).
@indie-rok
indie-rok / index.txt
Created January 8, 2019 23:31 — forked from EQuimper/index.txt
clear expo cache
rm -fr ~/.expo/starter-app-cache
module.exports = function solve(maze, miner, exit) {
let directionsArray = ["up", "right", "down", "left"];
const movements = {
left: { x: -1, y: 0 },
right: { x: 1, y: 0 },
up: { x: 0, y: -1 },
down: { x: 0, y: 1 }
};
const xNum = maze.length;
React Native Cheatsheet
+------------------------------+-----------------------------------------+--------------------------------------------------+
| | React | React Native |
+------------------------------+-----------------------------------------+--------------------------------------------------+
| CSS | inline + css | just inline |
+------------------------------+-----------------------------------------+--------------------------------------------------+
| HTML Containers | <div>,<section>, etc | <View/> |
+------------------------------+-----------------------------------------+--------------------------------------------------+
| HTML Text | <p>,<h1>,etc | <Text/> + style
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<h1>Contacts</h1>
<div id="contact-container"></div>
@indie-rok
indie-rok / client.js
Created January 11, 2022 08:06
websockets
import React, { useState, useEffect } from "react";
import { io } from "socket.io-client";
const socket = io("http://localhost:5000/");
function App() {
const [messageList, setMessageList] = useState([]);
const [nickName, setNickName] = useState("");
const [newMessageText, setNewMessageText] = useState("");
const [number, setNumber] = useState();
const n = 6;
const votes = ["red", "yellow", "blue", "red", "yellow", "red"];
function counter(n, votes) {
let histogram = {}; //https://en.wikipedia.org/wiki/Histogram
votes.forEach((vote) => {
if (!histogram[vote]) histogram[vote] = 0;
histogram[vote]++;
});
import json from "./data.json";
import { useState } from "react";
function App() {
const [data, setData] = useState(json);
const upvotePost = (postId) => {
const indexToModify = data.post.findIndex((post) => {
return post.id === postId;
});
import React from 'react';
import './App.css';
function App() {
return (
<div className="App">
<GreetingComponent />
</div>
);
const express = require('express')
const app = express()
const { Client } = require('pg')
require('dotenv').config()
app.get('/test', async (req, res) => {
let connectionString;