Skip to content

Instantly share code, notes, and snippets.

@shershen08
shershen08 / send-data-with-fetch.js
Created October 19, 2019 12:35
Svelte app send data
async function postData(data) {
const response = await fetch(API_URL, {
method: 'POST',
body: data
})
return await response.json()
}
@shershen08
shershen08 / app-state.js
Created October 19, 2019 12:25
Svelte form state object
export let STATE = {
send: {
success: null,
error: null,
isSent: false
},
validationErrors: {}
}
@shershen08
shershen08 / form.html
Last active October 19, 2019 12:31
Svelte form markup
<section>
<!-- {@debug STATE} -->
<h3 class="cont-title">Email Us</h3>
{#if STATE.send.success}
<div id="sendmessage">Your message has been sent. Thank you!</div>
{/if}
{#if STATE.send.error}
<div id="errormessage">{STATE.send.error} <br> Please try again</div>
{/if}
{#if !STATE.send.isSents}
@shershen08
shershen08 / example.html
Last active May 2, 2019 13:10
block html -> js
<!--исходный блок-->
<a href="https://newscom/1366--uvezli-iz--full.html" class="fint fint_horizontal fint_inside-fints-nest" target="_blank" rel="nofollow noreferrer">
<div class="fint__image">
<img src=".s/5bc6f8d81cbb8_4x3.jpg" alt="">
</div>
<div class="fint__content">
<div class="fint__title">Бла бла бла бла бла</div>
</div>
</a>
@shershen08
shershen08 / bash.bash
Created April 28, 2019 19:28
aliases and profile
alias c='clear'
alias ga='git add . && git commit -m'
alias gc='git checkout '
alias gg='git gc --prune=now'
alias gm='git checkout master'
alias gp='git pull'
alias gpp='git push'
alias gs='git status'
alias kit='~/go/src/github.com/kujtimiihoxha/kit/kit'
alias kkk='kill -kill $(lsof -t -i :$1)'
@shershen08
shershen08 / index.html
Created March 19, 2019 20:34
VueJS starter template
<div id="app">
{{foo}}
</div>
@shershen08
shershen08 / index.html
Created March 19, 2019 20:30
VueJS starter template
<div id="app">
<h1 v-bind:class="{'active-class':active}">home</h1>
<h2 @click="makeActive()">makeActive</h2>
</div>
</div>
@shershen08
shershen08 / index.html
Created November 9, 2018 12:45
vue form data
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="css/template_styles.min.css">
</head>
@shershen08
shershen08 / sample.sol
Created September 25, 2018 15:34
sample Ethereum contract: read/write globals, add uints
// read/write globals, add uints
// https://solidity.readthedocs.io/en/v0.4.24/units-and-global-variables.html
pragma solidity ^0.4.4;
contract SampleContract {
// This value is visible in etherscan.io explorer
uint256 public value;
@shershen08
shershen08 / hook.sh
Created July 26, 2018 14:10
pre-commit hook to disable changing some submodule
echo 'Check changes on frozen module MODULE_NAME'
SRC_PATTERN="MODULE_NAME"
git diff --name-only --cached $SRC_PATTERN | if grep -q $SRC_PATTERN;
then
log "FAIL: You are trying to commit to the MODULE_NAME"
log "This module has been moved to repository MODULE_NAME_REPOSITORY"
exit 1
fi