This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const KEY = "SENDGRID KEY HERE"; | |
const fs = require('fs'); | |
const html = fs.readFileSync('./index-1.html', 'utf8'); | |
var helper = require('sendgrid').mail; | |
var from_email = new helper.Email('[email protected]'); | |
var to_email = new helper.Email('[email protected]'); | |
var subject = 'Hello World from the SendGrid Node.js Library!'; | |
var content = new helper.Content('text/html',html); | |
var mail = new helper.Mail(from_email, subject, to_email, content); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
set myPath to POSIX path of input | |
set cmd to "vim " & quote & myPath & quote | |
tell application "iTerm" | |
activate | |
set newWindow to (create window with default profile) | |
tell current session of newWindow | |
write text cmd | |
end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LineStream extends Transform { | |
constructor(...args) { | |
super(...args); | |
this.buffer = ''; | |
} | |
_transform(chunk, encoding, callback) { | |
const lines = chunk.toString().split('\n'); | |
lines[0] = this.buffer + lines[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:encodeURIComponent(str) | |
let s = '' | |
for i in range(strlen(a:str)) | |
let c = a:str[i] | |
if c =~# "[A-Za-z0-9-_.!~*'()]" | |
let s .= c | |
else | |
let s .= printf('%%%02X', char2nr(a:str[i])) | |
endif | |
endfor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Input params | |
DOMAIN=$1 | |
UPSTREAM_PORT=$2 | |
# Check if config already exist (no overwrite) | |
if [ -f /etc/nginx/servers/$DOMAIN ]; then | |
echo "Config /etc/nginx/servers/$DOMAIN already exist. Remove it for continue" | |
exit 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
/* eslint-disable no-console */ | |
/* | |
* Логгер, создается в разных контекстах | |
* Имеет внутренний стейт, так как должнен быть создан и начать | |
* работать до запуска основных модулей | |
* | |
* Доступные уровни: ALL, WARN, ERROR, SILENT | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// item = {id: 'uniq id', field: 1, fielda: 'a'} | |
listOfItems.reduce((a, i) => ({...a, [i.id]:i}), {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILES=$(cat package.json | jq -r '.dependencies * .devDependencies | keys | join("\n")') | |
ARR=', ' read -r -a array <<< $FILES | |
echo Not found deps | |
echo | |
for dep in "${array[@]}" | |
do | |
grep -qr "$dep" src |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
101 - 100 | |
12 - 12 | |
12.3 - 12 | |
1.45 - 1.4 | |
*/ | |
N = 2 | |
parseFloat(a.toPrecision(N)) |