Skip to content

Instantly share code, notes, and snippets.

@Boorj
Boorj / bookmarklet-content.js
Last active April 23, 2023 07:08
ChatGPT Bookmarklet: copy dialog to clipboard in markdown
javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://gist.githubusercontent.com/Boorj/5c327ba6473a13fa47bf17fd4d872a69/raw/83feeda1e5c9436001300976316769ee0e5d77af/chatgpt-2-markdown.js';})();
@Boorj
Boorj / locations.txt
Created October 12, 2022 03:52
Windows files with icons
https://www.digitalcitizen.life/where-find-most-windows-10s-native-icons/
Where are Windows default icons located?
%systemroot%\system32\imageres.dll
%systemroot%\system32\shell32.dll
%systemroot%\system32\ddores.dll
%systemroot%\system32\pifmgr.dll
%systemroot%\explorer.exe
%systemroot%\system32\accessibilitycpl.dll
@Boorj
Boorj / bookmarklet.js
Last active September 1, 2022 03:09
Save youtube screenshot bookmarklet
javascript:(function()%7Bfunction%20prettyLocalDate(d)%20%7B%0A%20%20var%20millis%20%3D%20d.getTime()%20-%20(d.getTimezoneOffset()%20*%2060000)%3B%0A%20%20d.setTime(millis)%3B%0A%20%20return%20d.toISOString().slice(0%2C%2016).replace('T'%2C%20'--')%3B%0A%7D%0A%0A%0Afunction%20saveBlobAs(blob%2C%20name)%20%7B%0A%20%20%22use%20strict%22%3B%0A%0A%20%20var%20a%20%3D%20document.createElement(%22a%22)%3B%0A%20%20document.body.appendChild(a)%3B%0A%20%20a.style.cssText%20%3D%20%22display%3A%20none%22%3B%0A%0A%20%20var%20url%20%3D%20window.URL.createObjectURL(blob)%3B%0A%20%20a.href%20%3D%20url%3B%0A%20%20a.download%20%3D%20name%3B%0A%20%20a.click()%3B%0A%20%20window.URL.revokeObjectURL(url)%3B%0A%20%20a.parentNode.removeChild(a)%3B%0A%7D%0A%0Afunction%20makeVideoScreenshot()%20%7B%0A%20%20var%20vid%20%3D%20document.querySelector('video')%3B%0A%0A%20%20var%20canvas%20%3D%20document.createElement('canvas')%3B%0A%20%20var%20ctx%20%3D%20canvas.getContext('2d')%3B%0A%20%20if%20(!ctx)%20%7B%0A%20%20%20%20throw%20new%20Erro
@Boorj
Boorj / CodeMirror-extra-shortcuts.js
Last active October 19, 2020 17:00 — forked from IamPhytan/custom.js
Codemirror custom Keyboard Shortcuts / JetBrains keymap
// CodeMirror API - https://codemirror.net
/** Duplicate a current line in CodeMirror doc */
function cmDuplicateLine(cm) {
// get a position of a current cursor in a current cell
var currentCursor = cm.doc.getCursor();
// read a content from a line where is the current cursor
var lineContent = cm.doc.getLine(currentCursor.line);
@Boorj
Boorj / stockm.js
Created February 9, 2020 11:42
stockm1.
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=394)}([function(e,t,n){"use strict";e.exports=n(187)},function(e,t,n){e.exports=n(327)()},function(e,t){e.exports=fun
@Boorj
Boorj / getStackTrace.js
Last active January 17, 2020 07:20
JS: get stack trace
/**
* getStack
*
* @param {string | string[]} [excludeStr] - substrings that will mark stack line to be excluded
* @return {{
* method ?: string,
* url : string,
* line : number,
* column : number,
* }[]|[]}
@Boorj
Boorj / reset-postgres.md
Last active January 10, 2020 07:41
How to reset Postgres password on windows
  1. locate data folder and pg_hba.conf inside, for example C:\Program Files\PostgreSQL\12\data\pg_hba.conf ;

  2. open the file, you'll see:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host all all ::1/128 md5
@Boorj
Boorj / README.md
Last active April 23, 2019 12:41
Open file in PHP editor
  1. create a route for accepting reqeust to open
  2. create a controller and call launchEditor() from out there
  3. fix link in twig/html
  4. it requires working server to accept requests, so launch the server.

note It uses ??-operator so it's PHP7.0+

@Boorj
Boorj / debug_log.php
Created February 16, 2019 08:11
debug_log - utility for printing to debug output
<?php
/**
* debug_log
* @param {*} $data
* @param {string} $d = "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "bold" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough"
* */
function debug_log($data, $type = ''){
@Boorj
Boorj / excel_trigram_comparison.vb
Created November 6, 2018 13:19
Excel trigram (3 ngram) comparison function
Function preg_replace(text, strPattern As String, strReplace As String)
Dim txt As String: txt = text
Set regEx = CreateObject("VBScript.RegExp")
With regEx
.Global = True
.MultiLine = False
.IgnoreCase = False
.Pattern = strPattern