Skip to content

Instantly share code, notes, and snippets.

View wmakeev's full-sized avatar
💭
💻

Makeev Vitaliy wmakeev

💭
💻
View GitHub Profile
@wmakeev
wmakeev / _info.js
Last active June 28, 2019 11:02
Visual Studio Code snippets #vsc #env #snippets
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
@wmakeev
wmakeev / ext-pipe.js
Last active February 18, 2020 12:16
Imagemagick pipes #imagemagick #pipe
const fs = require('fs')
const path = require('path')
const spawn = require('child_process').spawn
// Gradient overlay example
// http://www.imagemagick.org/script/command-line-processing.php#input
const photoWriteStream = fs.createWriteStream(
path.join(__dirname, '/img-02-js-out.jpg')
)
@wmakeev
wmakeev / hiden_files.sh
Created September 4, 2016 10:36
Quickly Show/Hide Hidden Files on Mac OS X #osx
# http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/
# Show
defaults write com.apple.finder AppleShowAllFiles YES
# Hide
defaults write com.apple.finder AppleShowAllFiles NO
@wmakeev
wmakeev / base64-encode.js
Created September 10, 2016 10:17
Node base64 #node #base64
Buffer.from('foo').toString('base64')
@wmakeev
wmakeev / product-fetch.js
Created September 10, 2016 10:58
Moysklad JSON API #moysklad #api #json
'use strict'
require('dotenv').config()
const log = require('debug')('temp')
const nodeFetch = require('node-fetch')
const ENDPOINT = 'https://online.moysklad.ru/api/remap/1.1'
const { MOYSKLAD_LOGIN, MOYSKLAD_PASSWORD } = process.env
const auth = 'Basic ' + Buffer.from(`${MOYSKLAD_LOGIN}:${MOYSKLAD_PASSWORD}`, 'utf8')
@wmakeev
wmakeev / promisefy.js
Last active July 19, 2017 11:43
Promisefy.js #promise #tools
'use strict'
function promisefyFunction (func, context) {
return function () {
let args = Array.prototype.slice.call(arguments, 0)
return new Promise(function (resolve, reject) {
var cb = function (err, data) {
if (err) {
reject(err)
} else {
@wmakeev
wmakeev / npm-from-git.sh
Last active November 18, 2019 01:36
npm #npm #git
# https://docs.npmjs.com/cli/install
# 1
npm install <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish>]
## Examples
npm install git+https://[email protected]/visionmedia/express.git
npm install git+https://[email protected]/visionmedia/express.git#branch
# 2
npm install <githubname>/<githubrepo>[#<commit-ish>]
@wmakeev
wmakeev / gist:e21625ff31a125d8530eca19847acae1
Created October 15, 2016 10:30 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@wmakeev
wmakeev / TL.d.ts
Created November 20, 2016 07:51 — forked from richard1122/TL.d.ts
telegram typings #telegram #typings
// A typings definition of some telegram data structure
// author: Richard He<[email protected]>
// https://gist.github.com/richard1122/1eb54cd4e422aeb707718ab307decd34
// see more detail: https://core.telegram.org/bots/api
declare namespace TL {
export interface IResponse<T> {
ok:boolean
result:T
}
@wmakeev
wmakeev / npm.sh
Last active February 7, 2017 11:40
npm cannot find module 'internal/fs' #npm #error
cd /usr/local/n/versions/node/7.0.0/
sudo bin/npm i -g npm4
cd /usr/local/bin/
sudo mv npm4 npm