Skip to content

Instantly share code, notes, and snippets.

View ValeriaVG's full-sized avatar
🍓

Valeria ValeriaVG

🍓
View GitHub Profile
@ValeriaVG
ValeriaVG / dropzone-russian
Last active January 4, 2024 09:34
DropjoneJS russian language pack
/**
* Dropzone Default Language Translate pack
*
* @lang Russian
* @lang-ISO ru-RU
*
* @author ValeriaVG
* @license Public Domain
* @see https://gist.github.com/ValeriaVG/5ffcf92c98216e44e92d3db6a36ff838
@ValeriaVG
ValeriaVG / dropzone-custom-russian
Created October 27, 2016 08:37
Dropzone Custom upload form russian language
Dropzone.autoDiscover = false;
$(function() {
// Now that the DOM is fully loaded, create the dropzone, and setup the
// event listeners
var myDropzone = new Dropzone("#my-dropzone", {
dictDefaultMessage: "Перетащите файлы для загрузки в это поле",
dictFallbackMessage: "К сожалению, ваш браузер не поддерживает Drag'n'Drop",
dictFallbackText: "Пожалуйста, воспользуйтесь старой доброй формой для загрузки",
dictFileTooBig: "Файл слишком большой({{filesize}}MB). Максимальный допустимый размер файла {{maxFilesize}}MB",
dictInvalidFileType: "Вы не можете загружать файлы этого типа.",
@ValeriaVG
ValeriaVG / index.js
Last active April 16, 2019 23:44
create-hybrids-app: `npx [this gist url] [folder name]`
#!/usr/bin/env node
var util = require('util'),
spawn = require('child_process').spawn,
permissions = spawn('chmod',['+x',require('path').resolve(__dirname,'./index.sh')],{ stdio: [
0, // Use parent's stdin for child
'pipe', // Pipe child's stdout to parent
'pipe'
]})
cmd = spawn(require('path').resolve(__dirname,'./index.sh'), [process.argv[2]],{shell: true}); // the second arg is the command
// options
@ValeriaVG
ValeriaVG / index.html
Created May 13, 2019 08:03
How Google sees you SPA
<div id="root"></div>
@ValeriaVG
ValeriaVG / create.sh
Created May 13, 2019 08:29
Create React App
npm init react-app my-app
cd my-app
npm run eject
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
@ValeriaVG
ValeriaVG / build.sh
Created May 13, 2019 08:46
CRA tools
npm -g i serve
npm run build
serve -s build
@ValeriaVG
ValeriaVG / graphql.tsx
Created October 2, 2020 11:53
Minimalistic GraphQL client with hooks for React ( TypeScript)
import React, {
createContext,
useState,
useContext,
useEffect,
PropsWithChildren,
useCallback,
} from "react";
import { ExecutionResult, GraphQLError } from "graphql";
import { GraphQLQuery, GraphQLVariables } from "types";
@ValeriaVG
ValeriaVG / PreactFontAwesomeIcon.ts
Last active January 8, 2021 10:44
Preact FontAwesomeIcon
import { IconDefinition, icon, parse } from "@fortawesome/fontawesome-svg-core";
import { h, Ref } from "preact";
export default function FontAwesomeIcon({
forwardedRef,
...props
}: FontAwesomeIconProps) {
const {
icon: iconArgs,
mask: maskArgs,
@ValeriaVG
ValeriaVG / emotion.ts
Last active August 21, 2023 09:39
Fresh Emotion plugin
import { Plugin, PluginRenderScripts } from "$fresh/server.ts";
import createEmotionServer from '@emotion/server/create-instance'
import { cache } from '@emotion/css'
const { extractCritical } = createEmotionServer(cache)
const main = `data:application/javascript,import hydrate from "${new URL("./main.ts", import.meta.url).href
}";export default function(state) { hydrate(state); }`;
const emotion: Plugin = {