Skip to content

Instantly share code, notes, and snippets.

View rochabianca's full-sized avatar

Bianca rochabianca

View GitHub Profile
@rochabianca
rochabianca / javascript.json
Last active December 14, 2021 17:31
my javascript snippers
{
"starts test template": {
"prefix": "e2e",
"body": [
"import ${TM_FILENAME_BASE/(.*)/${1:/capitalize}/} from '../page-objects/${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}'",
"import General from '../page-objects/General'",
"",
"describe('${TM_FILENAME_BASE/(.*)/${1:/capitalize}/} Tests', () => {",
" const $TM_FILENAME_BASE = new ${TM_FILENAME_BASE/(.*)/${1:/capitalize}/}()",
" const general = new General()",
@rochabianca
rochabianca / vue.json
Last active March 13, 2023 01:17
Snippet to bring back scaffold on vue on vscode. To use it go to Code>Preferences>User Snippets type vue on the input and paste this code there.
{
"bring back the scaffold to vue files": {
"prefix": "scaffold",
"body": [
"<template>",
" <div>$TM_FILENAME_BASE</div>",
"</template>",
"",
"<script>",
"export default {",
@rochabianca
rochabianca / Example.vue
Created August 19, 2019 12:57
Function to map fields direct on vuex
<template>
<form>
<label for="email">Email</label>
<input type="email" id="email" name="email" v-model="email" />
<label for="senha">Senha</label>
<input type="password" id="senha" name="senha" v-model="senha" />
</form>
</template>
@rochabianca
rochabianca / example_threads.py
Created March 2, 2019 15:47
a simple example of how to make threads on python
import threading # essa é a biblioteca responsável pela crianção das threads
from datetime import datetime # biblioteca usada para pegar o tempo do sistema
def nao_passou_dois_segundos(tempo_inicial, tempo_final):
# verifica se o tempo no sistema agora é igual ao tempo inicial + o tempo que eu quero (nesse caso seria o tempo inicial + 2 segundos)
if(datetime.now().second == (tempo_inicial + tempo_final)):
# caso sim, retorna falso e para a thread
return False
else:
@rochabianca
rochabianca / numberFormatter.js
Created January 23, 2019 12:56
format a number without putting decimals (something like that)
let num = 24674
const formattedNum = num.toFixed(0).replace(/(\d)(?=(\d{3})+$)/g, "$1.") // if you want to use commas instead of dots, you can
// replace the "$1." to "$1,"
console.log(formattedNum) // 24.674
@rochabianca
rochabianca / gettingDownWithStyleVanilla.js
Created December 17, 2018 17:50
a animated scroll down, this time with vanilla js
function scrollIt(destination, duration = 200, easing = "linear", callback) {
const easings = {
linear(t) {
return t;
},
easeInQuad(t) {
return t * t;
},
easeOutQuad(t) {
return t * (2 - t);
@rochabianca
rochabianca / gettingDownWithStyle.html
Created December 17, 2018 12:14
slower and way more cool scroll to an section in the page. It needs jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<a href="#reference" class="styled-down">Click Me</a>
$l-device: 1200px;
$m-device: 760px;
$s-device: 480px;
@mixin d($size) {
@if $size == l {
@media screen and (min-width: #{$l-device}) {
@content;
}
}
// $pixel - number to be converted on em
// $context: font-size base (most browsers use 16px)
@function em($pixel, $context: 16) {
@return $pixel / $context + em;
}
@rochabianca
rochabianca / icon_animation.html
Created November 29, 2018 20:58
jQuery icon animation on hover. You can get a better view here: https://codepen.io/rochabianca/pen/pQQmWd?editors=1111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<svg class="icon__book" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 41 45.1">