Skip to content

Instantly share code, notes, and snippets.

View headStyleColorRed's full-sized avatar
🍊
Learning Ruby! :D

headStyleColorRed headStyleColorRed

🍊
Learning Ruby! :D
View GitHub Profile
let countries = [
Country(name: "United States", emoji: "🇺🇸"),
Country(name: "United Kingdom", emoji: "🇬🇧"),
Country(name: "Afghanistan", emoji: "🇦🇫"),
Country(name: "Albania", emoji: "🇦🇱"),
Country(name: "Algeria", emoji: "🇩🇿"),
Country(name: "Andorra", emoji: "🇦🇩"),
Country(name: "Angola", emoji: "🇦🇴"),
Country(name: "Antigua & Barbuda", emoji: "🇦🇬"),
Country(name: "Argentina", emoji: "🇦🇷"),
@headStyleColorRed
headStyleColorRed / medium_file_server_app.js
Last active August 17, 2021 08:19
MEDIUM File server app.js
const express = require("express")
const app = express();
const puerto = 8893;
const environment = process.env.NODE_ENV
const Cors = require("cors")
const fileupload = require('express-fileupload')
const jwt = require('jsonwebtoken');
// Middlewares
app.use(Cors());
function validateDataFields(params, paramsToMatch, origin) {
let i = 0;
let receivedData = Object.keys(params);
let missingFields = new Array();
let error = {
error: 0,
isError: false,
message: "",
error: null,
};
@headStyleColorRed
headStyleColorRed / medium_telegram_server_missing_part.js
Last active August 16, 2021 14:02
MEDIUM Missing telegram server
// Modules
const MichaelBot = require("./botLogic.js")
[. . . ]
// ++++++++++++++++ HTTP METHODS +++++++++++++++++++ //
[. . . ]
app.post("/send_message", async (req, res) => {
@headStyleColorRed
headStyleColorRed / medium_telegram_notification_bot.js
Last active August 16, 2021 13:51
MEDIUM telegram notification bot
const TelegramBot = require('node-telegram-bot-api');
function sendMessage(message, botId, chatId) {
const bot = new TelegramBot(botId, { polling: false });
try {
bot.sendMessage(chatId, message)
} catch {
return 'Something went wrong when trying to send a Telegram notification'
}
@headStyleColorRed
headStyleColorRed / medium_telegram_server.js
Last active August 16, 2021 13:59
MEDIUM Missing configuration telegram part
const express = require("express")
const app = express();
const puerto = 9001;
const Cors = require("cors")
// Middlewares
app.use(Cors());
app.use(express.json());
app.use(express.urlencoded({ extended: false }))
# Change theme to "awesomepanda"
apt-get install zsh
apt-get install git-core
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
source .zshrc
struct ControllerWrapper: UIViewControllerRepresentable {
typealias UIViewControllerType = <Your_Controller>
func makeUIViewController(context: UIViewControllerRepresentableContext<ControllerWrapper>) ->
ControllerWrapper.UIViewControllerType {
return <Your_Controller>()
}
func updateUIViewController(_ uiViewController: ControllerWrapper.UIViewControllerType,
cd $1 &&
npm uninstall --save typescript @types/jest @typescript-eslint/eslint-plugin @typescript-eslint/parser @vue/cli-plugin-typescript @vue/eslint-config-typescript &&
git add . && git commit -m "removed typescript modules" &&
rm tsconfig.json &&
mv src/main.ts src/main.js &&
rm src/shims-vue.d.ts &&
mv src/router/index.ts src/router/index.js &&
sed -i '' "s/: Array<RouteRecordRaw>//g" src/router/index.js &&
sed -i '' "s/import { RouteRecordRaw } from 'vue-router';//g" src/router/index.jsm &&
sed -i '' "s/<script lang=\"ts\">/<script>/g" src/App.vue &&
// ************************************************************************************************* //
//
// In order to upload a Smart contract we have to follow a series of steps:
//
// 1. Library imports
// a) solc: .sol file's extension compiler
// b) fs: Node native file reader
// c) web3: A new web3 instance that connects to Ganache's default port
//
// 2. Smart Contract compilation