Skip to content

Instantly share code, notes, and snippets.

View A77AY's full-sized avatar
🏔️

Rinat Arsaev A77AY

🏔️
View GitHub Profile
@kimyvgy
kimyvgy / MANUAL.md
Created May 24, 2018 01:52 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
@buddax2
buddax2 / GoogleTranslate.workflow
Created March 25, 2018 22:37
Google Translate Automator Service
on run {input, parameters}
set output to "http://translate.google.com/translate_t?sl=auto&tl=uk&text=" & urldecode(input as string)
return output
end run
on urldecode(x)
set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'"
do shell script "echo " & quoted form of x & " | ruby -e " & cmd
end urldecode
// Source of https://www.npmjs.com/package/physical-cpu-count
'use strict'
const os = require('os')
const childProcess = require('child_process')
function exec (command) {
const output = childProcess.execSync(command, {encoding: 'utf8'})
return output
@rodneyrehm
rodneyrehm / polyfill-intl.js
Created August 21, 2017 08:16
Webpack: load Intl polyfill with languages
const needsPolyfill = !window.Intl
/* eslint-disable import/no-webpack-loader-syntax */
const intl = require('bundle-loader?lazy&name=intl!intl')
/* eslint-enable import/no-webpack-loader-syntax */
const polyfilled = needsPolyfill && new Promise(resolve => {
intl(resolve)
})
@newyankeecodeshop
newyankeecodeshop / ServingES6.md
Last active June 19, 2021 07:36
Serving ES6 to modern browsers

Background

Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.

It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.

It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.

@evanwill
evanwill / gitBash_windows.md
Last active April 26, 2024 03:58
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@brennanMKE
brennanMKE / hero.ts
Last active April 1, 2024 16:16
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@parmentf
parmentf / GitCommitEmoji.md
Last active May 9, 2024 03:31
Git Commit message Emoji
@lgarron
lgarron / copyToClipboard.html
Last active December 20, 2023 12:53
Simple `navigator.clipboard.writeText()` polyfill.
<script>
// A minimal polyfill for copying text to clipboard that works most of the time in most capable browsers.
// Note that:
// - You may not need this. `navigator.clipboard.writeText()` works directly in all modern browsers as of 2020.
// - In Edge, this may call `resolve()` even if copying failed.
// - In Safari, this may fail if there is nothing selected on the page.
// See https://github.com/lgarron/clipboard-polyfill for a more robust solution.
//
// License for this Gist: public domain / Unlicense
function writeText(str) {