Skip to content

Instantly share code, notes, and snippets.

View romain130492's full-sized avatar

Rouiller Romain romain130492

View GitHub Profile
@romain130492
romain130492 / test.md
Created February 13, 2022 15:53
test test

When I started my web3 journey I got a freelance contract: Add web3 features to an existing app and reward the users with our token.

The point of rewarding the community was:

  • To motivate the community to do something to earn a token.
  • The brand wanted to have its own token to improve branding.
  • Rewarding the user with tokens is becoming more and more common these days.

Our users should get 5 tokens when completing their profile (bio, curriculum, social media links, etc.).

@romain130492
romain130492 / Transaction-ethereum-smart-contract.js
Last active November 27, 2021 02:53
Transaction-ethereum-smart-contract
var Web3 = require("web3");
// TO make a transaction from a wallet address to a smart contract address
// The smart contract has a function called : `set()`, which set a value to the data for the variable called : `data`
const init2 = async () => {
try {
const provider = new Web3.providers.HttpProvider(endPoint); // https://ropsten.infura.io/v3/ROPSTEN_API_KEY
web3 = new Web3(provider);
web3.eth.handleRevert = true;
@romain130492
romain130492 / getOpenid-wechat-login.js
Last active March 4, 2024 01:49
Wechat : Login the user, get the openId, getUserInfo
/**
* We login the user to our mini-program
* We get the user Info (the user info don't contain the unionId)
* We make a request to our back-end to request the unionId.
* * For security reason wechat doesn't allow us to make that request on the front-end : https://api.weixin.qq.com/sns/jscode2session?appid=${process.env.APP_ID}&secret=${process.env.APP_SECRET}&js_code=${js_code}
* * To make that request we need(see at the bottom) : {secret,appId, js_code(login code)}
/** Client-Side **/
import http from '../utils/http.js'
@romain130492
romain130492 / selenium-python-scraping.md
Last active April 7, 2020 02:26
#Selenium #Python #Scraping - wait

Scraping with Selenium/ Python

Wait to get an element on the page

    driver = webdriver.Firefox(firefox_options=options,
 executable_path=geckodriver)
@romain130492
romain130492 / Programmatic-Navigation.md
Last active April 7, 2020 02:26
#vue Programmatic Navigation

Programmatic Navigation

To go back to the last page visited

this.$route(-1)

<a @click="$router.go(-1)">back</a>
@romain130492
romain130492 / ml-python3-sklearn.md
Last active April 7, 2020 02:27
#Ml : sklearn- Prediction with #Python 3

Ml : sklearn

Prediction

from sklearn import tree


#height, weight, shoe size
X= [[181,80,44], [177,70,43],[160,60,38],[154,754,437],[166,65,40],
@romain130492
romain130492 / axios-node-async-multi-form-data.md
Last active April 7, 2020 02:27
#Axios - Async #Javascript Post request (Multi Form Data) with NodeJs
  • An async Post request (Multi Form Data) with NodeJs
    let formData = new FormData();
    formData.append('input_file', fs.createReadStream('your file path'));
    formData.append('parameter_1', 'your parameter');
    const getData = async url => {
        try {
            const res = await axios.post(url, formData, {
@romain130492
romain130492 / jest-parent-component-inject.md
Created March 3, 2020 04:14
Jest Inject and provide() method

Jest

inject data with provide

import UserTest from './seed/user-test'
import { createLocalVue, shallowMount, mount } from '@vue/test-utils'
import Component from '../dist'
const user = UserTest.user;
const userToken = UserTest.userToken;
@romain130492
romain130492 / dayJs_set_iso_date_time.md
Last active March 1, 2020 04:25
day.js Set an ISO with a specific date & time & UTC
  • Import Modules
import dayjs from 'dayjs'
var utc = require('dayjs/plugin/utc')
dayjs.extend(utc)
  • Date and input User
 
@romain130492
romain130492 / Computed_property_return.md
Last active February 29, 2020 06:40
Computed property return statement
computed_property() {
      this.variable = new Date(this.currentUtc)
      return this.variable
    }
   const variable2 = this.computed_property()

OR more simply

computed_property() {