Skip to content

Instantly share code, notes, and snippets.

View tvolodimir's full-sized avatar

Volodymyr tvolodimir

View GitHub Profile
const npmPackageName = "ts-morph"; // <--- change name
const got = require("got@11.8.2");
const url = (name) =>
`https://api.npms.io/v2/package/${encodeURIComponent(name)}`;
const map = [];
require("npm-pack-dependents@2.0.0")(npmPackageName)
.then((dependents) => {
return Promise.allSettled(
dependents.map((d) => {
@tvolodimir
tvolodimir / readme.md
Last active October 29, 2020 21:45
light require.js PoC

#require.js #PoC #topological-sorting #DAG

PoC of require.js

@tvolodimir
tvolodimir / conditional-promises-chaining.ts
Last active May 25, 2018 11:04
#demo: promises/aysnc/callback js
// conditional promises chaining
function preTask(): Promise<void> {
console.log('pre task');
return Promise.resolve();
}
function task1(): Promise<void> {
console.log('task for type1');
return Promise.resolve();
@tvolodimir
tvolodimir / entry.js
Created April 27, 2016 12:12
rollup.js + babel + source map
let app = {};
import * as arrowFunction from './test_arrowFunction.js';
app.arrowFunction = arrowFunction;
import * as exportDefaultClass from './test_exportDefaultClass.js';
app.exportDefaultClass = exportDefaultClass;
window.app = app;
console.log(app);
@tvolodimir
tvolodimir / TimeActionWrapper.cs
Created September 14, 2014 07:28
TimeAction Wrapper
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Timer = System.Timers.Timer;
public class TimerAction
{
private readonly Action action;
private readonly Timer timer;
@tvolodimir
tvolodimir / Proxy.cs
Created September 14, 2014 06:12
tcp proxy
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace Proxy
{
class Program
{
static void Main(string[] args)
<!DOCTYPE html>
<html>
<head>
<title>abc abcd</title>
<script>
function ReplaceNode(textNode, eNode) {
textNode.parentNode.replaceChild(textNode, eNode);
}
function DecorateText(node, match, offset) {
@tvolodimir
tvolodimir / CircleBuffer.js
Created January 10, 2014 08:55
CircleBuffer
// http://jsperf.com/circle-buffer-vc-array
var CircleBuffer = function (size) {
this._size = size; // max count of data
this._list = [];
this._cursorIndex = 0;
this._startIndex = 0;
this.length = 0; // actual data length
};
CircleBuffer.prototype = {
@tvolodimir
tvolodimir / serializer.cs
Last active February 17, 2016 06:32
serializers c#
public static T XmlDeserializeFromString<T>(string objectData)
{
return (T)XmlDeserializeFromString(objectData, typeof(T));
}
public static object XmlDeserializeFromString(string objectData, Type type)
{
var serializer = new XmlSerializer(type);
object result;