Skip to content

Instantly share code, notes, and snippets.

View R-A-S's full-sized avatar
:octocat:
🐱‍💻🐱‍👤

Roman S R-A-S

:octocat:
🐱‍💻🐱‍👤
View GitHub Profile
@vladilenm
vladilenm / JavaScript Fetch.js
Last active March 1, 2024 02:28
JavaScript Fetch + XMLHttpRequest
const requestURL = 'https://jsonplaceholder.typicode.com/users'
function sendRequest(method, url, body = null) {
const headers = {
'Content-Type': 'application/json'
}
return fetch(url, {
method: method,
body: JSON.stringify(body),
@devxom
devxom / html.json
Last active December 24, 2022 01:01
https://gist.github.com/akella/9757676 snippets ported for vscode
{
"Block (with comment)": {
"prefix": "di",
"body": [
"<!-- begin ${1} -->",
"<div class=\"${1}\">",
"\t${2}",
"</div>",
"<!-- end ${1} -->"
]
@mentos1386
mentos1386 / Webstorm-Airbnb-Javascript-codeStyle.xml
Created March 12, 2017 11:03
Airbnb inspired Webstorm Javascript CodeStyle
<code_scheme name="Airbnb">
<option name="RIGHT_MARGIN" value="100" />
<option name="HTML_ATTRIBUTE_WRAP" value="4" />
<option name="HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE" value="" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
<DBN-PSQL>
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
@vlucas
vlucas / encryption.js
Last active July 23, 2024 01:24
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);