Skip to content

Instantly share code, notes, and snippets.

View Ibro's full-sized avatar

Ibrahim Šuta Ibro

View GitHub Profile
@Ibro
Ibro / Category.cs
Created April 24, 2018 18:16
ASP.NET Core Authorization - Managing permissions for resources - Category class
public class Category
{
public string Id { get; set; }
public string Name { get; set; }
public ApplicationUser User { get; set; }
public string UserId { get; set; }
}
@Ibro
Ibro / Set.js
Last active February 27, 2018 05:23
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let arr = [ 13, 11, 15, 21, 13, 11, 17, 17, 19, 19, 21 ];
let uniqueArray = [...new Set(arr)];
console.log(uniqueArray); // [13, 11, 15, 21, 17, 19]
@Ibro
Ibro / Map.js
Created February 27, 2018 05:11
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let obj = {};
console.log(obj['toString'])
console.log(obj['hasOwnProperty'])
console.log(obj['constructor'])
@Ibro
Ibro / Set.js
Last active February 27, 2018 04:36
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let set = new Set([9, 15]);
set.add(44);
let arr = [...set];
console.log(arr); // [9, 15, 44]
@Ibro
Ibro / Set.js
Created February 26, 2018 13:32
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let set = new Set([3, 5, true, 'This is a string, obviously.']);
for (let item of set) {
console.log(item);
}
@Ibro
Ibro / Map.js
Last active February 26, 2018 09:24
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let map = new Map([['name', 'CodingBlast'], ['points', 33], [true, 55], ['true', 44]])
console.log(Array.from(map.keys()))
console.log(Array.from(map.values()))
console.log(Array.from(map.entries()))
@Ibro
Ibro / Map.js
Last active February 26, 2018 09:23
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let map = new Map([['name', 'CodingBlast'], ['points', 33], [true, 55], ['true', 44]])
console.log(map.get(true))
console.log(map.get('true'))
@Ibro
Ibro / Map.js
Last active February 26, 2018 09:24
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
for (let key of map.keys()) {
console.log('key:' + key);
}
for (let value of map.values()) {
console.log('value:' + value);
}
@Ibro
Ibro / Map.js
Last active February 26, 2018 09:23
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let map = new Map([['name', 'CodingBlast'], ['points', 33], [true, 55], ['true', 44]])
for (let [key, value] of map.entries()) {
console.log('key is ' + key + ', value is ' + value);
}
@Ibro
Ibro / Set.js
Last active February 26, 2018 09:23
CodingBlast blog - Set, Map - https://codingblast.com/javascript-set-map/
let set = new Set([3, 5, true, 'This is a string, obviously.']);
for (let item of set.values()) {
console.log(item);
}
console.log('Adding a new value');
set.add(5);
for (let item of set.values()) {