Skip to content

Instantly share code, notes, and snippets.

View barbagrigia's full-sized avatar

Vlad Trukhin barbagrigia

View GitHub Profile
@RPG-18
RPG-18 / main.cpp
Last active September 1, 2021 08:46
Get books from one book resource
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
MainWindow w;
w.show();
@fredericmarx
fredericmarx / .hyper.js
Created July 22, 2017 14:22
Configuration file for Hyper https://hyper.is/
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: '"Input Mono", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@acdlite
acdlite / prefetch.js
Last active June 11, 2021 08:34
Prefetching in React
function prefetch(getKey, getValue, getInitialValue, propName) {
const inFlight = new Set();
const cache = new Map();
return ChildComponent => {
return class extends React.Component {
state = {value: getInitialValue(this.props)};
componentWillReceiveProps(nextProps) {
const key = getKey(nextProps);
if (cache.has(key)) {
// Use cached value
const ChartjsNode = require('chartjs-node');
// 600x600 canvas size
var chartNode = new ChartjsNode(600, 600);
var randomnumber=Math.random();
var imagename = "testimage"+randomnumber+".png"
module.exports = imagename
// each api returns a Promise
chartNode.drawChart({
type: 'bar',
@zmts
zmts / material_icons.md
Last active July 8, 2017 12:32
Material icons, проблема отображения

Столкнулся спроблемой не отображались Material иконки.

<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">

Проблема была скрыта в reset.css он перекрывал стили Material а именно тег <i>. Решение убрать этот тег из ресета.

/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/
@andywer
andywer / talk-proposal.md
Last active December 23, 2020 17:22
Reactive Conf 2017 ⚡️ Talk Proposal - Memory Leak Hunt 2017 Style

This is a proposal for lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal!

Memory Leak Testing in 2017

Hi, I am Andy, creator of leakage - the node-powered memory leak testing library.

Instead of manual debugging it provides a structured approach to fix or even prevent memory leaks.

(ns birch.core
(:require [clojure.string :as str]))
;; (println ">>>" (first *command-line-args*))
(def node-fs (js/require "fs"))
(def node-path (js/require "path"))
(def read-dir (.-readdirSync node-fs))
(def stat (.-statSync node-fs))
@surma
surma / importPolyfill.js
Created May 6, 2017 17:17
Polyfill for dynamic module loading
_registry = {};
importPolyfill = path => {
if(!(path in _registry)) {
const entry = _registry[path] = {};
entry.promise = new Promise(resolve => entry.resolve = resolve);
document.head.appendChild(Object.assign(
document.createElement('script'),
{
type: 'module',
innerText: `import * as X from '${path}'; _registry['${path}'].resolve(X);`,
@threepointone
threepointone / glam-for-css-folks.md
Last active September 4, 2022 07:43
why css purists will love glam

I made a little styling lib called glam

(some features are in development)

one

let's start off with the simplest use case. we'll make an 'index.html' page, and assume we've setup our js bundler to output bundle.js

@samthor
samthor / safari-nomodule.js
Last active September 19, 2025 16:07
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.: