Skip to content

Instantly share code, notes, and snippets.

@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
79/02/28. 19.27.34.
PROGRAM DND1
00010 LET J4=1
00030 PRINT
00100 BASE 0
00110 LET X=0
00120 LET J=0
00130 LET K=0
00140 X1=0
@GerHobbelt
GerHobbelt / .gitignore
Created July 8, 2012 14:41
d3.js: force layout; click to group/bundle nodes
# Editor backup files
*.bak
*~
@rlb3
rlb3 / gcd.m
Created May 16, 2011 19:17 — forked from chrishulbert/gcd.m
Tricks with grand central dispatch
// Using grand central dispatch (GCD) so we don't block the GUI
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// Background, long stuff runs here, but doesn't affect the GUI
dispatch_async(dispatch_get_main_queue(), ^{
// The GUI thread stuff goes here
[self.tableView reloadData]; // example