Skip to content

Instantly share code, notes, and snippets.

View negue's full-sized avatar
👨‍💻
Nerding around

negue

👨‍💻
Nerding around
View GitHub Profile
@joni
joni / toUTF8Array.js
Last active May 14, 2024 09:23
toUTF8Array: Javascript function for encoding a string in UTF8.
function toUTF8Array(str) {
var utf8 = [];
for (var i=0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) utf8.push(charcode);
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f));
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
@lgersman
lgersman / README.md
Last active July 2, 2021 03:41
state diagram editor example based on (https://gist.github.com/lgersman/5311083)
  • Click into the drawing area to start the selection frame
  • move the mouse to resize the selection frame
  • Release the mouse button to resize the selection frame
  • circles are draggable
  • circles can be selected (multiple selections possible by pressing CTRL while clicking a circle)
  • the selection frame selects all circles within the frame (by pressing CTRL the selected circles will be appended to current selection)
  • multiple selected circles will be dragged simultaneous

new features:

@itod
itod / split_keyboards.md
Last active June 12, 2024 12:08
Every "split" mechanical keyboard currently being sold that I know of
@aldo-roman
aldo-roman / compress.js
Last active November 11, 2021 13:48
Brotli compression with Angular CLI
const brotli = require('brotli')
const fs = require('fs')
const brotliSettings = {
extension: 'br',
skipLarger: true,
mode: 1, // 0 = generic, 1 = text, 2 = font (WOFF2)
quality: 10, // 0 - 11,
lgwin: 12 // default
}
@shlomiassaf
shlomiassaf / lazy-drag-drop.ts
Created November 15, 2018 23:00
Lazy binding between `CdkDrag` and `CdkDropList` + support for non direct draggables in a drop container
import { take } from 'rxjs/operators';
import { Input, Directive, ElementRef, QueryList, OnDestroy, Optional, AfterViewInit } from '@angular/core';
import { CdkDropList, CdkDrag, CdkDragHandle, CDK_DROP_LIST_CONTAINER } from '@angular/cdk/drag-drop';
@Directive({
selector: '[cdkLazyDropList]',
exportAs: 'cdkLazyDropList',
providers: [
{ provide: CDK_DROP_LIST_CONTAINER, useExisting: CdkLazyDropList },
],
@Lightnet
Lightnet / gunjstrustsharekey.js
Last active January 28, 2021 09:14
gunjstrustsharekeyv3
/*
Self contain Sandbox Gun Module chain for auth sea.js:
Created by: Lightnet
License: MIT
Version: 3.0
Last Update:2019.08.17
Credit: amark ( https://github.com/amark/gun)
Status(Work in progress!):
@Dletta
Dletta / index.html
Created September 7, 2019 03:37
Gun in Service Worker
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Concept Chat</title>
<link rel="stylesheet" href="index.css" >
</head>
<body>
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active July 16, 2024 05:43
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@messified
messified / vscode_reduce_cpu_usage.md
Created October 30, 2019 18:15
VSCode Reduce CPU Usage

VSCode Reduce CPU Usage

Update your settings.json with the code below, then restart vscode:

{
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
 "**/.hg": true,
@jabis
jabis / Sending and reading Messages with gun.js
Last active June 14, 2022 08:56
Send and receive messages with gun
/*so let's simplify you have
- your letters (all messages, yours & other peer) which you draw to DOM
- you have your outbox , when you say something, that the other person listens to with .on(...)
and adds to their letters when they arrive
- you listen with .on(...) the other peers messages and add them to letters when
they arrive
- on your send(){...} you would add the message to your letters
and to the outbox so your message can trigger the other persons .on */
class Chat {