Skip to content

Instantly share code, notes, and snippets.

View isuvorov's full-sized avatar
🎃
Программирую и предпринимаю

Igor Suvorov isuvorov

🎃
Программирую и предпринимаю
View GitHub Profile
@isuvorov
isuvorov / __dirname.js
Created April 18, 2024 05:09
ESM __dirname and __filename
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
export const getFilename = (meta) => fileURLToPath(meta.url);
export const getDirname = (meta) => dirname(getFilename(meta));
const __filename = getFilename(import.meta);
const __dirname = getDirname(import.meta);

Keybase proof

I hereby claim:

  • I am isuvorov on github.
  • I am isuvorov (https://keybase.io/isuvorov) on keybase.
  • I have a public key ASD5qn4ExWcLTwlUu47d3UDiQqy_Q11g9EvlEIKuc5ZC9Qo

To claim this, I am signing this object:

@isuvorov
isuvorov / cloudSettings
Last active October 31, 2019 17:04
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-10-18T15:35:18.403Z","extensionVersion":"v3.4.3"}
root@mgbeta:/projects/backup# ls -1 /backups/mongo.buzz.guru__buzzguru_master__hour/
2018_11_01__00_00_01
2018_11_01__01_00_01
2018_11_01__02_00_01
2018_11_01__03_00_01
2018_11_01__04_00_01
2018_11_01__05_00_02
2018_11_01__06_00_02
2018_11_01__07_00_13
2018_11_01__08_00_03
import React from 'react';
import Avatar from './Avatar';
import _ from 'lodash';
const rndNum = _.random(99);
const avatarImg = `https://randomuser.me/api/portraits/men/${rndNum}.jpg`;
const smallImg = 'http://placeimg.com/32/32/people';
const largeImg = 'http://placeimg.com/1920/1920/people';
const noProportionalImg = 'http://placeimg.com/640/320/people';
/* eslint-disable */
import _ from 'lodash'
export const R = 6371
export function deg2rad(deg) {
return deg * (Math.PI / 180)
}
export function getDistance(point1, point2) {
const vector = {
/////
// Mongoose
// user.server.js
import schema from '/models/user'
const MongooseUser = mongoose.model('User', schema.getMongooseSchema())
MongooseUser.findOne({
username: 'isuvorov'
})
.then(user => {
export default class CoursePage extends Component {
componentDidMount() {
this.startLoad()
}
startLoad() {
const params = this.props.params
this.course = this.props.user.api.getCourse(params.courseId)
}
const SocketManager = {
// unmapper: {
// socket: ['Post_1', 'Post_2']
// },
mapper: {
'Post_1': [ {socket, events:[]}, socket2, socket3 ],
'Post_2': [],
},
# README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# Terminal.app - it has significantly better color fidelity.