Skip to content

Instantly share code, notes, and snippets.

View mucluck's full-sized avatar
👾
grabbing

D mucluck

👾
grabbing
View GitHub Profile
function *fibonacci(amount = 0) {
let counter = 0;
let [prev, next] = [1, 0];
while(counter < amount) {
yield next;
[prev, next] = [next, prev + next];
counter++;
}
@mucluck
mucluck / README.md
Created December 8, 2022 01:12 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@mucluck
mucluck / umi-graphql
Last active May 23, 2021 22:21
UMI JS GraphQL loader
chainWebpack(config, { webpack }) {
config.module.rule('graphql-tag')
.test(/\.(graphql|gql)$/)
.use('raw')
.loader('graphql-tag/loader')
},
@mucluck
mucluck / AKS
Last active December 24, 2020 11:56
AKS Primality Test Javascript implementation
// This works only till num = 64
function isPrime(num) {
if(num > 1) {
const accum = [1];
for (let i = 0; i < num; accum[0] = -accum[0], i++) {
accum[1 + i] = 1;
for (let j = i; j > 0; j--) {
accum[j] = accum[j - 1] - accum[j];
@mucluck
mucluck / BalsamicSans.scss
Created November 10, 2020 12:13
Google Roboto and BalsamicSans font locally import SCSS
/* Balsamic regular */
@font-face {
font-family: "BalsamicSans";
src: url("./BalsamiqSans-Regular.ttf") format('truetype');
font-weight: 400;
font-style: normal;
}
/* Balsamic regular italic */
@mucluck
mucluck / tokens.md
Created October 13, 2020 20:46 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
{
"window.zoomLevel": 0,
"breadcrumbs.enabled": true,
"editor.renderControlCharacters": false,
"editor.renderWhitespace": "all",
"workbench.colorTheme": "Miami",
"javascript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
@mucluck
mucluck / v8.md
Created February 12, 2020 11:50 — forked from kevincennis/v8.md
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • sudo nano ~/.bash_profile
  • Add export PATH=/path/to/depot_tools:"$PATH" (it's important that depot_tools comes first here)
const GUID = () => { // GUID unique ID getter
return ((((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + "-" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + "-4" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1).substr(0, 3) + "-" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + "-" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1) + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)).toLowerCase();
};
$(function () {
_.map($('[data-widget-collection=data-widget-collection]'), function (node) {
let observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.addedNodes.length) {
console.log(mutation);
}
});
});