Skip to content

Instantly share code, notes, and snippets.

View DimitarNestorov's full-sized avatar
📞
🔙

Dimitar Nestorov DimitarNestorov

📞
🔙
View GitHub Profile
@DimitarNestorov
DimitarNestorov / exceptionHandler.js
Last active July 28, 2017 00:14
[$rootScope:inprog] null already in progress
function exceptionHandler(){
const error = Error;
const nullMessage = "[$rootScope:inprog] null already in progress";
function exception(message){
if(message.indexOf(nullMessage) === 0){
const $rootScope = exceptionHandler.$rootScope;
if($rootScope) $rootScope.$$phase = null;
const exception = new error(nullMessage);
@DimitarNestorov
DimitarNestorov / placeholder.js
Created October 24, 2017 18:55
Placeholder Generator
const placeholder = (function(){
const cache = {};
const canvas = document.createElement(`canvas`);
const type = (function(){
canvas.width = canvas.height = 100;
const context = canvas.getContext(`2d`);
context.rect(0, 0, 100, 100);
const webp = {
type: `image/webp`,
quality: 1
@DimitarNestorov
DimitarNestorov / TokenList.js
Created December 26, 2017 00:54
Simplified custom DOMTokenList implementation.
const forEach = Array.prototype.forEach;
module.exports = class TokenList {
constructor(){
this.tokens = {};
this.add.apply(this, arguments);
}
add(){
const { tokens } = this;
@DimitarNestorov
DimitarNestorov / angularapp.js
Last active May 2, 2018 10:34
@sentry/electron support for AngularJS
const sentry = require('./sentry.js').moduleName;
angular.module('app', ['your', 'dependencies', sentry]);
import { useState, useCallback } from 'react';
function useStateRef(initialValue) {
const [ref, setState] = useState(initialValue)
const callback = useCallback(
ref => {
setState(ref)
},
[ref, setState]
@DimitarNestorov
DimitarNestorov / code.js
Last active February 24, 2019 17:24
hash code pizza practice problem
const fs = require('fs')
const file = fs.readFileSync('./a_example.in', 'utf8')
// const file = fs.readFileSync('./b_small.in', 'utf8')
function cloneArray(arr) {
return arr.slice(0)
}
function cloneMatrix(arr) {
@DimitarNestorov
DimitarNestorov / tsts.ts
Created April 23, 2019 21:37
TypeScript toolset
type PromiseType<T> = T extends Promise<infer U> ? U : T
// const myPromise = new Promise<string>(() => {})
// type MyPromiseType = PromiseType<typeof myPromise> // string
@DimitarNestorov
DimitarNestorov / gist:360b6ea0fd5e17e0f01d5d27407ad7e4
Last active November 7, 2019 01:02
App Store links for macOS
https://apps.apple.com/app/macos-catalina/id1466841314?mt=12
https://apps.apple.com/app/macos-mojave/id1398502828?ls=1&mt=12
https://apps.apple.com/app/macos-high-sierra/id1246284741?ls=1&mt=12
https://apps.apple.com/app/macos-sierra/id1127487414?ls=1&mt=12
https://apps.apple.com/app/os-x-el-capitan/id1147835434?mt=12
@DimitarNestorov
DimitarNestorov / shell.md
Last active October 21, 2019 13:46
Why it is called that way

cd - change directory

ls - list directory contents

cp - copy files

man - format and display the on-line manual pages

mv - move files

@DimitarNestorov
DimitarNestorov / react-devtools+4.7.0.patch
Last active June 17, 2020 05:53
React DevTools npm dark patch
diff --git a/node_modules/react-devtools/app.html b/node_modules/react-devtools/app.html
index 75fc137..bfc3c1b 100644
--- a/node_modules/react-devtools/app.html
+++ b/node_modules/react-devtools/app.html
@@ -12,7 +12,7 @@
height: 100%;
margin: 0;
padding: 0;
- background-color: #fff;
+ background-color: #000;