Skip to content

Instantly share code, notes, and snippets.

@ruselknow
ruselknow / InterfaceInjection.cs
Created September 27, 2021 13:34
Interface Injection
using System;
namespace DependencyInjection
{
public interface IDependent
{
void DoSomething();
}
public class Dependent1 : IDependent
{
@ruselknow
ruselknow / MethodInjection.cs
Created September 27, 2021 12:44
Method Injection
using System;
namespace DependencyInjection
{
public interface IDependent
{
void DoSomething();
}
public class Dependent1 : IDependent
{
@ruselknow
ruselknow / SetterInjection.cs
Created September 27, 2021 12:40
Setter Injection
using System;
namespace DependencyInjection
{
public interface IDependent
{
void DoSomething();
}
public class Dependent1 : IDependent
{
@ruselknow
ruselknow / ConstructorInjection.cs
Last active September 27, 2021 12:22
Example of Constructor Injection
using System;
namespace DependencyInjection
{
public interface IDependent
{
void DoSomething();
}
public class Dependent1 : IDependent
{
@ruselknow
ruselknow / PropertyInjection.cs
Last active September 27, 2021 12:32
Property Injection
using System;
namespace DependencyInjection
{
public interface IDependent
{
void DoSomething();
}
public class Dependent1 : IDependent
{
--log_gc (Log heap samples on garbage collection for the hp2ps tool.)
type: bool default: false
--expose_gc (expose gc extension)
type: bool default: false
--max_new_space_size (max size of the new generation (in kBytes))
type: int default: 0
--max_old_space_size (max size of the old generation (in Mbytes))
type: int default: 0
--max_executable_size (max size of executable memory (in Mbytes))
type: int default: 0
@ruselknow
ruselknow / gist:b37351c89407d0e97addc92b3ef7b55e
Created December 11, 2019 09:46 — forked from deepanprabhu/gist:fbb406c3432c19eafe78a4b44e6a4b23
Concise Recursive DynamoDB Scan - Large Table - Using ExclusiveStartKey and LastEvaluatedKey - NodeJS
let params = {
TableName: 'xxx',
Limit: 50 // Configure based on needs
};
let aItems = [];
const recursiveScan = (params) => {
return client.scan(params).promise().then((data) => {
// Simple Changes to input, optional
let newItems = data.Items.map((item) => {
return item;
# remove commits local and remoute
git checkout <remoute branch>
git reset --hard <last_working_commit_id>
git push --force
@ruselknow
ruselknow / play.js
Created October 21, 2019 12:21 — forked from pbakondy/play.js
Play with Object.prototype.toString.call()
// under Google Chrome 36
Object.prototype.toString.call([])
// "[object Array]"
Object.prototype.toString.call(function(){})
// "[object Function]"
Object.prototype.toString.call({})
// "[object Object]"
Object.prototype.toString.call(null)
// "[object Null]"
@ruselknow
ruselknow / async-foreach.js
Created October 21, 2019 11:23 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)