A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
A curated list by Eric Elliott and friends. Suggest links in the comments below.
This is a very exclusive collection of only must-have JavaScript links. I'm only listing my favorite links. Nothing else makes the cut. Feel free to suggest links if you think they're good enough to make this list. The really curious should feel free to browse the comments to find other links. I can't guarantee the quality of links in the comments.
Some of these links are affiliate links, meaning that if you make a purchase, I might earn a little money. This has absolutely no bearing on whether or not links make the list. None, whatsoever. However, it does allow me more resources to fight poverty with code. Every little bit counts.
var a = [[1,2,[3]],4, [5, [6, 7, [8, [9]]]]]; | |
function flattenNestedArrays(arr){ | |
var flattenedArray = []; | |
(function flattenArray(arr){ | |
arr.forEach(function(item){ | |
if(Array.isArray(item)){ | |
flattenArray(item); | |
}else{ |
function addf(x) { | |
return function(y) { | |
return x + y; | |
} | |
} | |
addf(3)(4) | |
------------------------- |
[user] | |
email = ksaweryglab@gmail.com | |
name = codeepic | |
[alias] | |
a = add --all | |
s = status | |
c = commit -m | |
ca = commit --amend | |
co = checkout | |
p = push |
constructor( | |
private route: ActivatedRoute, | |
private router: Router, | |
private dashboardService: DashboardService | |
){ | |
super(); | |
} | |
ngOnInit(){ | |
let sub = this.route.params.subscribe(params => { |
this.form.setValue({search: ''}); //you have to provide all form controls | |
//OR | |
this.form.patchValue({search: ''}); //you can only provide 1 form control that you want to update |
export class FunctionalUtil{ | |
static removeItem<T>(arr: T[], index: number): T[]{ | |
return [ | |
...arr.slice(0, index), | |
...arr.slice(index + 1) | |
]; | |
} | |
static replaceItem<T>(arr: T[], item: T, index: number): T[]{ |
FWIW: I didn't produce the content present here. I've just copy-pasted it from somewhere over the Internet, but I cannot remember exactly the original source. I was also not able to find the author's name, so I cannot give him/her the proper credit.
// https://stackoverflow.com/questions/15935318/smooth-scroll-to-top | |
// based on Gor answer | |
const scrollToTop = () => { | |
const c = document.documentElement.scrollTop || document.body.scrollTop; | |
if (c > 0) { | |
window.requestAnimationFrame(scrollToTop); | |
window.scrollTo(0, c - c / 8); | |
} | |
}; | |
scrollToTop(); |