Skip to content

Instantly share code, notes, and snippets.

View modjke's full-sized avatar

Ignatiev Mikhail modjke

View GitHub Profile
@modjke
modjke / boostrap.js
Last active December 13, 2020 12:27
Enabling certain permissions at stratup in strapi 3
'use strict';
module.exports = async () => {
const publicRole = await getRoleByName('Public')
grantPermissions(publicRole, 'application', 'images', ['upload', 'remove']) // upload, remove in 'images' controller
grantPermissions(publicRole, 'application', 'project') // any action in 'project' controller
};
async function getRoleByName(name) {
return strapi.query('role', 'users-permissions').findOne({ name }, [])
@modjke
modjke / app.js
Last active September 24, 2020 12:49 — forked from adriandmitroca/app.js
Lottie, automatically fixing SVG scaling issue on Internet Explorer 11, but it's actually runnable on Internet Explorer 11 and no jQuery
function lottieIeFixer (el, perspective) {
if (typeof perspective === 'undefined') {
perspective = 'width';
}
if (!window.navigator.userAgent.indexOf('Windows') > -1 &&
!window.navigator.userAgent.indexOf('rv:11.0') > -1) {
return;
}
@modjke
modjke / .bashrc
Last active May 3, 2019 15:55
Enable ssh-agent automatic launch and sharing between multiple git-bash instances (windows, git-bash)
# Enable ssh-agent automatic launch and sharing between multiple git-bash instances
#
# Env vars used
# SSH_AUTH_SOCK - ssh-agent socket, should be set for ssh-add or git to be able to connect
# SSH_AGENT_PID - ssh-agent process id, should be set in order to check that it is running
# SSH_AGENT_ENV - env file path to share variable between instances of git-bash
SSH_AGENT_ENV=~/ssh-agent.env
# import env file and supress error message if it does not exist
. $SSH_AGENT_ENV 2> /dev/null
@modjke
modjke / 10b28bit.bat
Created October 23, 2017 08:18
.BAT to convert 10 bit MKV with subtitles to 8 bit MP4 keeping subtitles
::save as .bat, drag and drop video
::converts 10 bit MKV (or whatever ffmpeg supports) to 8 bit MP4
::before converting anything take a closer look at MAP param
::maybe you dont need to map anything at all (leave as 'set MAP=')
::subtitles copied as mov_text too
set IN=%1
set OUT="%~dp1e_%~nx1"
set MAP=-map 0:0 -map 0:2 -map 0:4
ffmpeg.exe -i %IN% %MAP% -c:v h264_nvenc -preset default -pix_fmt yuv420p -crf 23 -c:a copy -scodec mov_text -c:s copy -copy_unknown -c:v h264_nvenc -y %OUT%
@modjke
modjke / LinearLayoutPagerManager.java
Last active November 7, 2022 23:50
RecyclerView's LinearLayoutManager with the ability to set a fixed number of items to be displayed
package ;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
public class LinearLayoutPagerManager extends LinearLayoutManager {
private int mItemsPerPage;