Skip to content

Instantly share code, notes, and snippets.

View Mike-Savin's full-sized avatar

Michael Savin Mike-Savin

View GitHub Profile
@f1ames
f1ames / uploadadapter.js
Last active May 26, 2019 11:45
Base64UploadAdapter CKEditor5
/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
/* globals window */
/**
* @module adapter-base64/uploadadapter
*/
@scryptonite
scryptonite / 0_README.md
Last active October 24, 2019 01:52
Dumps all Sequelize models to JSON to help with creating the first migration script.
  1. Modify & run dump-sequelize-schema.js.
    • It currently uses a few lodash methods, so be sure to temporarily install them—or if you feel up to it you can rewrite the script so they're not needed.
    • npm i lodash.sortby lodash.pick lodash.omit lodash.mapvalues
  2. Inspect sequelize-schema.json and make sure it appears represent all of your tables, attributes, indexes, constraints, references, etc...
  3. When you are satisfied, copy and rename sequelize-schema.json file into a migration-extras/ directory that is next to your migrations/. Name it initial-sequelize-schema.json.
    • migration-extras/
      • -> initial-sequelize-schema.json
    • migrations/
      • (this folder should probably be empty)
  4. Run sequelize migration:create and then copy the contents of 2018XXXXXXXXXX-initial-migration.js into the newly generated migration script. No additional modifications are required if y
@dweldon
dweldon / install-docker.sh
Last active April 8, 2022 11:18
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
@sorenlouv
sorenlouv / cpu-intensive.js
Last active December 19, 2023 06:00
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
}
mySlowFunction(8); // higher number => more iterations => slower
@maciakl
maciakl / gist:5039730
Created February 26, 2013 16:18
Word 2007 Configuring Every Time - Quick Fix:

Word 2007 Configuration Fix

If you have Word 2003 and 2007 installed on the same machine, recent updates might have caused a condition in which 07 it runs the configuration dialog every time you open a document. A quick workaround is:

  • Open regedit
  • Navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Options
  • Create new DWORD called NoReReg
  • Give it a hexadecimal value of 1
@saippuakauppias
saippuakauppias / gist:4714695
Last active August 24, 2019 04:35
javascript vkontakte api wall post: постинг на стену к текущему пользователю на JS vk API. С помощью этого кода так же можно отправлять записи на стены групп, пользователей и публичных страниц (пабликов). Используется в iframe приложениях вконтакте.
/*
* message - сообщение, которое будет опубликовано
* image - картинка для постинга
* user_id - id текущего пользователя (к нему будет осуществлён постинг)
*/
function wallPost(message, image, user_id) {
VK.api('photos.getWallUploadServer', {
uid: user_id
}, function (data) {
if (data.response) {