Skip to content

Instantly share code, notes, and snippets.

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

Luis J. Centeno LuisHCK

🏠
Working from home
View GitHub Profile
@LuisHCK
LuisHCK / setup_server.sh
Created April 27, 2021 00:03
Setup ubuntu server + nodejs + nginx + pm2 + certbot
# Install nodejs
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
yarn --version
@LuisHCK
LuisHCK / react.md
Last active February 3, 2021 03:10
react.md

Parent.js

import React from 'react'

export default function Parent() {
    const [myState, setMyState] = useState()

    return (
        <div>
 

Componente1.vue (Padre)

<template>


</template>

<script>
export default {
@LuisHCK
LuisHCK / index.js
Created April 3, 2019 20:39
PDF.js get loading percent
const loadingTask = window.PDFJS.getDocument(documentUrl);
loadingTask.onProgress = ({loaded, total}) => {
// do something here
const percentLoaded = Math.round((loaded * 100) / total);
};
@LuisHCK
LuisHCK / index.html
Created March 28, 2019 01:56
Clase de html
<!DOCTYPE html>
<html>
<!-- En Head se definen propiedades de la pagina -->
<!-- Estas propiedades no se muestran -->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Mi pagina</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<template>
<div>
<form @submit.prevent="login()">
<input v-model="email" type="text">
<input v-model="password" type="password">
</form>
</div>
</template>
<script>
@LuisHCK
LuisHCK / django-ModelMultipleChoiceField-crispy.md
Created October 17, 2018 17:55 — forked from s-boardman/django-ModelMultipleChoiceField-crispy.py
Django 1.11 Using ModelMultipleChoiceField outside Admin interface with Crispy-Forms

How to use the ModelMultipleChoiceField widget outside the Django admin interface

when processing forms with Crispy-forms

Prerequisites

django-crispy-forms installed and included in settings (as per crispy docs)

Edited files:

urls.py (root, not app/urls.py)

@LuisHCK
LuisHCK / material-colors.json
Created September 21, 2018 01:59 — forked from kawanet/material-colors.json
Material Design Style Color Palette as JSON
{
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"200": "#ef9a9a",
"300": "#e57373",
"400": "#ef5350",
"500": "#f44336",
"600": "#e53935",
"700": "#d32f2f",
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@LuisHCK
LuisHCK / postman_installer
Last active April 1, 2019 15:43
chmod +x postman_installer
#!/bin/bash
cd /tmp || exit
echo "Downloading Postman ..."
wget -q --show-progress https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz
tar -xzf postman.tar.gz
rm postman.tar.gz
echo "Installing to opt..."
if [ -d "/opt/Postman" ];then
sudo rm -rf /opt/Postman