Skip to content

Instantly share code, notes, and snippets.

View Meir017's full-sized avatar
🎯
Focusing

Meir Blachman Meir017

🎯
Focusing
View GitHub Profile
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CodeFixes;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using System.Threading;
using System.Linq;
@Meir017
Meir017 / FlakyTestMethodAttribute.cs
Last active August 4, 2023 13:37
MSTest flaky test
namespace Playground.Tests
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class FlakyTestMethodAttribute : TestMethodAttribute
{
public int RetryCount { get; set; }
public override TestResult[] Execute(ITestMethod testMethod)
{
TestResult result = testMethod.Invoke(new object[0]);
@Meir017
Meir017 / script.js
Last active August 25, 2022 19:53
convert node modules to tgz
const { existSync, writeFileSync, mkdirSync } = require('fs');
const { execSync } = require('child_process');
if (!existsSync('package.json')) {
writeFileSync('package.json', JSON.stringify({ dependencies: {} }, null, 2));
}
function saferequire(name) {
try {
return require(name);
{"1to2":["1.0.0"],"7zip-bin":["0.0.3"],"7zip-bin-win":["2.1.0"],"@angular/compiler-cli":["2.2.3","2.4.1","2.4.10","2.4.6","2.4.7","4.0.0","4.0.2","4.0.3","4.1.1","4.1.3","4.2.4","4.2.5","4.3.5","4.3.6","4.4.6","5.0.0","5.0.5","5.2.1","5.2.2"],"Base64":["0.2.1"],"CSSselect":["0.4.1"],"CSSwhat":["0.4.7"],"JSONStream":["0.10.0","0.4.3","0.6.4","0.7.4","0.8.4","1.0.3","1.0.6","1.0.7","1.1.1","1.2.1","1.3.0","1.3.1","1.3.2"],"JSV":["4.0.2"],"MD5":["1.3.0"],"NodObjC":["1.0.0"],"Swan":["1.0.0","1.0.1","1.0.2","1.0.3"],"URIjs":["1.16.1"],"a":["1.0.0"],"aabb-3d":["0.0.0"],"abab":["1.0.3","1.0.4"],"abbrev":["1.0.3","1.0.5","1.0.7","1.0.9","1.1.0","1.1.1"],"absolute":["0.0.1"],"absolute-path":["0.0.0"],"abstract-leveldown":["0.12.3","0.12.4","2.4.1","2.6.0","2.6.1"],"accept":["1.0.0","2.1.0","2.1.1"],"accepts":["1.0.0","1.0.6","1.0.7","1.1.4","1.2.13","1.2.7","1.3.2","1.3.3","1.3.4","1.3.6"],"access-control":["0.0.8"],"accessibility-developer-tools":["2.10.0"],"accessory":["1.0.1"],"accord":["0.20.5","0.22.3","0.23.0","
@Meir017
Meir017 / npm-links.json
Created March 11, 2018 17:14
npm-links.json
@Meir017
Meir017 / find-dups.js
Created March 16, 2018 07:00
find-duplicates in a node_module directory
const glob = require("glob");
const fs = require('fs');
const mainDir = 'angular-cli-demo';
const dups = {};
const packageJsons = glob.sync(`${mainDir}/node_modules/**/package.json`);
for (const packageJson of packageJsons) {
try {
const json = require(packageJson);
if(!json.name || !json.version) {
@Meir017
Meir017 / cdn-data.md
Last active March 23, 2018 06:59
offline cdn
@Meir017
Meir017 / benchmark.md
Last active April 24, 2018 20:40
C# return tasks

Program.cs

using BenchmarkDotNet.Running;

namespace Benchmarks
{
    class Program
    {
        static void Main()
        {
@Meir017
Meir017 / promise-queue.js
Last active April 26, 2018 19:18
nodejs promise queue
class PromiseQueue {
constructor(tasks = []) {
this.task = Promise.resolve();
for (const { func, args } of tasks) {
this.run(func, ...args);
}
}
run(func, ...args) {
return new Promise((resolve, reject) => {