I hereby claim:
- I am gnaeus on github.
- I am dmitrypanyushkin (https://keybase.io/dmitrypanyushkin) on keybase.
- I have a public key ASCBXfDHAQxFQXBdk6N2GKSSeZ9jiL5E-N7Eto1VVe3Wlgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
class FirstStore extends Injectable {} | |
class SecondStore extends Injectable { | |
firstStore = this.getInstance(FirstStore); | |
} | |
class FirstComponent extends ConnectedComponent { | |
firstStore = this.getInstance(FirstStore); | |
secondStore = this.getInstance(SecondStore); |
var computerInfo = new Microsoft.VisualBasic.Devices.ComputerInfo(); | |
ulong occupied = computerInfo.TotalPhysicalMemory - computerInfo.AvailablePhysicalMemory; | |
float occupiedPercentage = (float)occupied / computerInfo.TotalPhysicalMemory; |
using System; | |
using System.Threading; | |
namespace BastardInjection | |
{ | |
public abstract class Transient<T> where T : new() | |
{ | |
public static T Instance => new T(); | |
} |
function usersReducer(state, action) { | |
switch (action.type) { | |
case CHANGE_NAME: | |
const { id, name } = action.payload; | |
return { | |
byId: protoMerge(state.byId, { | |
[id]: { | |
...state.byId[id], | |
name: name, | |
} |
function protoMerge(source, changes, mergeThreshold = 100) { | |
let result; | |
const proto = Object.getPrototypeOf(source); | |
if (proto === Object.prototype || proto == null) { | |
// если source создан как object literal - то просто наследуемся от него | |
result = Object.create(source); | |
} else { | |
const sourceKeys = Object.keys(source); | |
const sourceLength = sourceKeys.length; |
function usersReducer(state, action) { | |
switch (action.type) { | |
case CHANGE_NAME: | |
const { id, name } = action.payload; | |
return { | |
byId: { | |
...state.byId, | |
[id]: { | |
...state.byId[id], | |
name: name, |
users: { | |
byId: { | |
"user1": { | |
id: "user1", | |
name: "John", | |
}, | |
"user2": { ... }, | |
... | |
}, | |
allIds: [ "user1", "user2", ... ], |