View solana-fns.ts
This file contains 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
import dotenv from "dotenv"; | |
dotenv.config(); | |
import assert from "assert"; | |
import * as web3 from "@solana/web3.js"; | |
import * as fs from "fs"; | |
/** | |
* Constants | |
*/ |
View do-if-exist-pattern.js
This file contains 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 doIfExist(obj, predicateValuesPaths, fn) { | |
const values = predicateValuesPaths.map((keyPath) => get(obj, keyPath)) | |
if (all(values, truthy)) { | |
return fn(...values) | |
} | |
return | |
} |
View roman_num.rb
This file contains 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 Roman | |
NUMS = [ | |
[10, 'X'], | |
[9, 'IX'], | |
[5, 'V'], | |
[4, 'IV'], | |
[1, 'I'] | |
].freeze | |
def self.from(val) |
View make-derived-calculations-template.js
This file contains 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 K = 1000 | |
const M = 1000 * K | |
const KB = 1000 | |
const MB = 1000 * KB | |
const GB = 1000 * MB | |
const TB = 1000 * GB | |
const PB = 1000 * TB | |
function Calc () { | |
this.value = 100 * K |
View attach-download-multer-wrapper-azure.js
This file contains 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
import { resolve } from 'path'; | |
import fs from 'fs'; | |
import { createBlobService } from 'azure-storage'; | |
import config from 'config'; | |
/** | |
* Service to handle files downloads requests | |
* | |
*/ |
View operators.c
This file contains 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
/* | |
//so far we've worked with some basic operators | |
Positive and negative operators (unary) | |
+ | |
- | |
Arithmetic (binary) | |
+ | |
- | |
/ | |
* |
View site_migration_check.sh
This file contains 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
curl https://dmitryshvetsov.com/sitemap.xml | \ | |
grep -e loc | \ | |
sed 's:<loc>\(.*\)<\/loc>$:\1:g' | \ | |
sed -e 's/^[[:space:]]*//' | \ | |
sed 's/https:\/\/dmitryshvetsov\.com/http:\/\/localhost:8000/' | \ | |
while read -r line; do open $line; done |
View smalltalk_inspired_if_else_averse_in_ruby.rb
This file contains 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 Object | |
def if_true | |
yield | |
self | |
end | |
def if_false | |
self | |
end | |
end |
View roman-to-arabic-converter.js
This file contains 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 ARABIC_ROMAN_MAP = [ | |
["M", 1000], | |
["CM", 900], | |
["D", 500], | |
["CD", 400], | |
["C", 100], | |
["XC", 90], | |
["L", 50], | |
["XL", 40], | |
["X", 10], |
View arabic-roma-map.js
This file contains 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 ARABIC_ROMAN_MAP = [ | |
["M", 1000], | |
["CM", 900], | |
["D", 500], | |
["CD", 400], | |
["C", 100], | |
["XC", 90], | |
["L", 50], | |
["XL", 40], | |
["X", 10], |
NewerOlder