Skip to content

Instantly share code, notes, and snippets.

View studentIvan's full-sized avatar
🎯
Focusing

Ivan Maslov | JavaScript & Web Performance Enthusiast studentIvan

🎯
Focusing
View GitHub Profile
/* eslint-disable */
var loaderUtils = require('loader-utils');
/**
* getLocalIdent function for preact-css-modules
* do (null, null, className) for manual use
*/
var getLocalIdent = (context, localIdentName, localName, options) => {
var result = localName;
/** exclude some classNames */
--c--- get multiplier from things todo object
on getMultiplierFromToDo(theToDo, defaultMultiplierValue)
local theToDo
set toDoName to name of theToDo
set multiplier to second character of toDoName
set multiplierBefore to first character of toDoName
set multiplierAfter to third character of toDoName
set isValidMultiplier to ((multiplierBefore is equal to "[") and (multiplierAfter is equal to "]"))
set multiplierValue to defaultMultiplierValue
if isValidMultiplier then set multiplierValue to multiplier as real
@studentIvan
studentIvan / bash commands (one by one)
Last active January 16, 2019 11:32
net::ERR_CERT_AUTHORITY_INVALID chrome solution for mac os mojave, ssl errors fix for https://localhost
openssl genrsa -des3 -passout pass:x -out localhost.pass.key 2048
openssl rsa -passin pass:x -in localhost.pass.key -out localhost.key
rm localhost.pass.key
openssl req -new -key localhost.key -out localhost.csr -config $(pwd)/openssl.cnf -subj "/C=SW/ST=Gothenburg/L=localhost/O=Ridestore/OU=localhost/CN=localhost/[email protected]/subjectAltName=DNS.1=localhost/"
openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt -extfile v3.ext
/**
* simple memoize registry
*/
const ApplicationRegistry = {
instance: Object.create(null),
getInstance() {
return this.instance;
},
};
@studentIvan
studentIvan / device.service.js
Last active August 16, 2018 16:09
Device service javascript helper
/* global window, location, navigator, Element */
/* eslint comma-dangle: "off", no-prototype-builtins: "off", no-param-reassign: "off" */
/**
* device service
* @version 2.0.1
*/
module.exports = {
cache: {},
/**
import { canRoute, customHistory, routeTo } from './preact-router.local';
import { appRegistry, eventsService } from '../../../services/service-manager';
/**
* Local setURL function overwrite from preact-router
*
* @param {string} url url, applied to router
* @param {string} type optional operation name, default = push
* @param {{ realURL: string, displayURL: string }} newState state object
*/
@studentIvan
studentIvan / package.json
Last active March 5, 2018 16:02
Translation react script for plugin babel-plugin-jsx-i18n-tag-translate-replacer and transifex
{
"scripts": {
"script:translations:pull": "BABEL_ENV='node' babel-node util/translations/translations.script.js pull",
"script:translations:generate": "BABEL_ENV='node' babel-node util/translations/translations.script.js generate"
},
"dependencies": {
"babel-plugin-jsx-i18n-tag-translate-replacer": "github:studentIvan/babel-plugin-jsx-i18n-tag-translate-replacer",
"transifex-api-es6": "github:studentIvan/transifex-api-es6#fix-deps"
}
}
@studentIvan
studentIvan / mongo_db_recover_delete_record-2.4.py
Created August 4, 2017 10:15 — forked from guss77/mongo_db_recover_delete_record-2.4.py
Try to recover deleted documents from a mongodb 2.4 data file. Based on https://gist.github.com/egguy/2788955 with help from https://yazadk.wordpress.com/2015/07/15/a-forensic-perspective-on-recovering-deleted-data-from-big-data-systems/#MongoDB . Make sure to change `decode_chunk` so it properly detects the objects you are trying to recover - i…
#!/usr/bin/python
"""A little script to recover deleted recording of a mongoDB db file
There's no optimization but it work and has saved me
"""
import struct
import bson
import pymongo
@studentIvan
studentIvan / just an example
Created December 13, 2016 19:22
example.styl
.calendar-dropdown
min-width auto !important
border solid 1px lightgray !important
&__select2
position absolute
top 0
width 100%
background red
z-index 500
var isSupportsBasicES6, isSupportsDefaultParamsDestructing, appVersionCode,
getScriptLocation, includeScript, scriptBasePath, modulePaths, bundleDependencies;
/**
* url to scripts on the server
* @type {String}
*/
scriptBasePath = '/scripts/';
/**