Skip to content

Instantly share code, notes, and snippets.

View studentIvan's full-sized avatar
🎯
Focusing

Ivan Maslov studentIvan

🎯
Focusing
View GitHub Profile
@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/emailAddress=ivan@ridestore.com/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/';
/**
/**
* iPhone mixin
* example:
* +iphone(all, landscape)
* body
* display none
*/
iphone($version = all, $orientation = all)
$orientation == all ? 'and' : 'and (orientation: ' + $orientation + ') and'
if $version == '4' or $version == '4S' or $version == 'all'
ipad($version = all, $orientation = all)
$orientation == all ? 'and' : 'and (orientation: ' + $orientation + ') and'
if $version == mini or $version == 1 or $version == 2 or $version == all
$query = 'only screen and (min-device-width: 768px) and (max-device-width: 1024px) %s (-webkit-min-device-pixel-ratio: 1)' % $media-orientation
@media $query
{block}
if $version == 3 $version == 4 or $version == all
$query = 'only screen and (min-device-width: 768px) and (max-device-width: 1024px) %s (-webkit-min-device-pixel-ratio: 2)' % $media-orientation
@media $query
{block}