Skip to content

Instantly share code, notes, and snippets.

View CyberLight's full-sized avatar
🎓
in training

Aleksandr Vishniakov CyberLight

🎓
in training
View GitHub Profile
@CyberLight
CyberLight / gist:53c67a1fe960cc162c366614a04320bb
Created July 2, 2023 05:21 — forked from dvdbng/gist:1762527
HTML DOM to Markdown in javascript
/*
You can use this to convert a DOM element or a HTML string to markdown.
Usage examples:
var markdown = toMarkdown(document.getElementById("content"));
// With jQuery you can easily convert HTML strings
var markdown = toMarkdown($("<ul><li>Hi!</li></ul>")[0]);
@CyberLight
CyberLight / tailwind-webpack-setup.md
Created February 12, 2023 12:36 — forked from bradtraversy/tailwind-webpack-setup.md
Setup Webpack with Tailwind CSS

Webpack & Tailwind CSS Setup

Create your package.json

npm init -y

Create your src folder

Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.

@CyberLight
CyberLight / punctuation.js
Created June 27, 2019 11:39 — forked from davidjrice/punctuation.js
List of punctuation characters
var PUNCTUATION = "" +
"’'" + // apostrophe
"()[]{}<>" + // brackets
":" + // colon
"," + // comma
"‒–—―" + // dashes
"…" + // ellipsis
"!" + // exclamation mark
"." + // full stop/period
"«»" + // guillemets
@CyberLight
CyberLight / nodb_template_tag.py
Created June 22, 2019 12:02 — forked from kurtgn/nodb_template_tag.py
Django-тег, запрещающий SQL в шаблонах
import contextlib
import json
from django.db import connection
from django import template
register = template.Library()
@CyberLight
CyberLight / 1. Usage.sh
Created May 17, 2019 07:09 — forked from Integralist/1. Usage.sh
Configure Wrk https://github.com/wg/wrk (brew install wrk) with Lua to execute against multiple URLs
$ docker run --rm -v "$(pwd)/multi-request-json.lua":/multi-request-json.lua -v "$(pwd)/requests.json":/requests.json czerasz/wrk-json wrk -c1 -t1 -d5s -s /multi-request-json.lua https://www.example.com
multiplerequests: Found 2 requests
multiplerequests: Found 2 requests
Running 5s test @ https://www.example.com
1 threads and 1 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 887.09ms 415.48ms 1.36s 60.00%
@CyberLight
CyberLight / medium_clap.html
Created April 14, 2019 16:40 — forked from JonathanDn/medium_clap.html
Medium Clap Reproduction - My take on it by looking, researching and trial & error. Demo available --> https://jsfiddle.net/urft14zr/425/
<div class="canvas">
<div id="totalCounter" class="total-counter"></div>
<div id="clap" class="clap-container">
<i class="clap-icon fa fa-hand-paper-o"></i>
</div>
<div id="clicker" class="click-counter">
<span class="counter"></span>
</div>
@CyberLight
CyberLight / react_tz.md
Created October 4, 2018 15:32 — forked from beshkenadze/react_tz.md
Тестовое задание для ReactJS Frontend-разработчика

##Погодное одностраничное веб-приложение

(!) Данные можно взять с сайта openweathermap.org или с любого другого сервиса.

(!) Обязательно использовать react.js и redux.

Приложение должно уметь:

  • Добавлять/удалять города
  • Сохранять локально данные
@CyberLight
CyberLight / ActionTypeMatching.js
Created July 26, 2018 08:38 — forked from mayank23/ActionTypeMatching.js
Jest user defined asymmetric matchers
import * as actionTypes from './action-types.js';
class ActionTypeMatching extends AsymmetricMatcher {
constructor(expected){
this.$$typeof = Symbol.for('jest.asymmetricMatcher');
this.expected = expected;
}
asymmetricMatch(other) {
@CyberLight
CyberLight / cleanTypenameFieldLink.ts
Created July 4, 2018 05:18 — forked from cdelgadob/cleanTypenameFieldLink.ts
This is a custom ApolloLink which we use to clean the "__typename" field to prevent sending it to the GraphQL server. omitDeep based on this gist: https://gist.github.com/Billy-/d94b65998501736bfe6521eadc1ab538
@CyberLight
CyberLight / formikApollo.js
Created May 2, 2018 08:48 — forked from mwickett/formikApollo.js
Formik + Apollo
import React from 'react'
import { withRouter, Link } from 'react-router-dom'
import { graphql, compose } from 'react-apollo'
import { Formik } from 'formik'
import Yup from 'yup'
import FormWideError from '../elements/form/FormWideError'
import TextInput from '../elements/form/TextInput'
import Button from '../elements/form/Button'
import { H2 } from '../elements/text/Headings'