Skip to content

Instantly share code, notes, and snippets.

@FbN
FbN / vite.config.js
Last active April 18, 2024 08:36
vite.config.js node built-in polyfills
// yarn add --dev @esbuild-plugins/node-globals-polyfill
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
// yarn add --dev @esbuild-plugins/node-modules-polyfill
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
import rollupNodePolyFill from 'rollup-plugin-node-polyfills'
export default {
resolve: {
alias: {
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
// import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
@Feiron
Feiron / start.php
Last active June 9, 2021 11:20
[Testing BP создаем / выводим лог, оптционально удаляем все] #bitrix #bp
<?
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
$APPLICATION->SetTitle("Тестирование");
CModule::IncludeModule('gpw.testing');
CModule::IncludeModule('im');
CModule::IncludeModule('bizproc');
$iTemplateID = XXX;
@Feiron
Feiron / convert_utf8.php
Created June 22, 2018 09:24
Исправляет сайт на utf
<?
error_reporting(E_ALL & ~E_NOTICE);
if(version_compare(phpversion(), '5.0.0') == -1)
die('PHP 5.0.0 or higher is required!');
require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
header("Content-type: text/html; charset=cp1251");
echo '<html><head><title>Конвертация сайта в UTF8</title></head><body>';
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@Feiron
Feiron / csvwork.php
Last active January 8, 2019 20:13
Bitrix csv work
<?
CModule::IncludeModule('crm');
CModule::IncludeModule('gpw.1cdb');
CModule::IncludeModule('gpw.payments');
require_once($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/csv_data.php");
$csvFile = new CCSVData('R', true);
$csvFile->LoadFile($_SERVER['DOCUMENT_ROOT'] . '/testing/file.csv');
$csvFile->SetDelimiter(';');
@akella
akella / preload_array.js
Created September 2, 2017 11:32
Preload array of images with callback
function loadImages(paths,whenLoaded){
var imgs=[];
paths.forEach(function(path){
var img = new Image;
img.onload = function(){
imgs.push(img);
if (imgs.length==paths.length) whenLoaded(imgs);
}
img.src = path;
});
@jofftiquez
jofftiquez / firebase_copy.js
Last active April 7, 2024 13:29 — forked from katowulf/firebase_copy.js
Firebase realtime database - how to copy or move data to a new path?
function copyFbRecord(oldRef, newRef) {
return Promise((resolve, reject) => {
oldRef.once('value').then(snap => {
return newRef.set(snap.val());
}).then(() => {
console.log('Done!');
resolve();
}).catch(err => {
console.log(err.message);
reject();
anonymous
anonymous / webpack.config.js
Created March 31, 2017 07:32
const webpack = require('webpack')
const fs = require('fs')
// NODE_ENV
const nodeEnv = process.env.NODE_ENV || 'development'
const isProd = nodeEnv === 'production'
module.exports = (options) => {
let entryFile, outputPath, isClient, isServer
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var path = require('path');
var webpack = require('webpack');
var noVisualization = process.env.NODE_ENV === 'production'
|| process.argv.slice(-1)[0] == '-p'
|| process.argv.some(arg => arg.indexOf('webpack-dev-server') >= 0);
module.exports = {
entry: {
main: './reactStartup.js'