Skip to content

Instantly share code, notes, and snippets.

View fnnzzz's full-sized avatar

Vlad Feninets fnnzzz

View GitHub Profile
@fnnzzz
fnnzzz / regexp.js
Created March 29, 2018 11:52
regexp
/*
Регулярные выражения
https://regexr.com/
https://regexper.com/
https://developer.mozilla.org/uk/docs/Web/JavaScript/Reference/Global_Objects/RegExp
*/
/*
@fnnzzz
fnnzzz / shell.sh
Created March 23, 2018 16:08
power shell global rename
Get-ChildItem D:\dev\sandbox\geometry-presbuilder\_source_media\catalog_feb_2018\PDF -Recurse -File | ForEach-Object{ Rename-Item -Path $_.FullName -NewName $_.name.ToLower().Replace('pdf', '.pdf')}
@fnnzzz
fnnzzz / woodshed-calc.js
Last active December 14, 2017 14:36
woodshed calculator script
var clickEvent = new Event('click')
if(!$('.djn-dynamic-form-calculator-calculator').length) {
$('.add-handler.djn-model-calculator-calculator')[0].dispatchEvent(clickEvent)
$('#id_calc_to_item-0-name').val('calc_' + Date.now())
}
window.addNewGroup = function(obj) {
Object.keys(obj).map((key, index) => {
$('.add-handler.djn-model-calculator-additionalcharacteristic').first()[0].dispatchEvent(clickEvent)
@fnnzzz
fnnzzz / text.md
Created December 8, 2017 16:34
mac egghead docker

пока не удалил, как тянул с egghead видео:

apt-get update && apt-get install -y ffmpeg

дальше найти ссылку на m3u8 на страничке (там она и в страничке есть и по аяксу приходит)

и запустить комманду по типу такой:

@fnnzzz
fnnzzz / index.html
Created November 17, 2017 13:08
inline react
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<div id="root"></div>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.1.1/umd/react.production.min.js"></script>
@fnnzzz
fnnzzz / emitter.js
Created August 24, 2017 04:51
simple emitter (pub/sub)
const Emit = () => {
let listeners = {}
const on = (eventName, listenerCb) => {
if(listeners.hasOwnProperty(eventName)) {
console.error('Already exist')
return
}
if(typeof eventName !== 'string') {
@fnnzzz
fnnzzz / glob.js
Created July 28, 2017 10:08
glob compare files
const glob = require('glob')
module.exports = () => {
const entryDir = './src/'
let filesListObject = {}
const formatFilePath = (path) => path.replace(entryDir, '').replace('.js', '')
const files = glob.sync(`${entryDir}**/*.js`)
@fnnzzz
fnnzzz / chokidar.js
Created July 28, 2017 10:08
compare files chokidar
const getFiles = require('./getFilesHelper')
const chokidar = require('chokidar')
const shallowequal = require('shallowequal')
module.exports = (compiler, timeInterval = 1000) => {
if(!compiler) return
const checkFiles = () => {
const oldFilesList = compiler.options.entry
const newFilesList = getFiles()
@fnnzzz
fnnzzz / index.js
Created July 19, 2017 19:49
redux-from-zero-to-heo
state => {
counter: 0
}
reducer => (state, action) {
if( action.type === 'INCREMENT' ) {
return state + 1
}
if( action.type === 'DECREMENT' ) {
@fnnzzz
fnnzzz / watch.js
Created July 5, 2017 18:42
chokidar watcher
const chokidar = require('chokidar')
const path = require('path')
const cp = require('child_process');
let initialScanIsComplete = false
const timeInterval = 5000
let lastRun = 0
let webpackProcess = null
const watcher = chokidar.watch('src', { ignored: /[\/\\]\./, persistent: true })