Skip to content

Instantly share code, notes, and snippets.

@dodie
dodie / Terminal env
Created November 30, 2014 17:21
Terminal env
TERM=xterm-256color
@dodie
dodie / gist:f2c558c13ad29e165bf2
Created January 6, 2015 10:04
Xvfb take screenshot
Where 0 is the Xvfb screen number:
DISPLAY=:0 import -window root screenshot.png

#FP intro

Lambda calculus, Alonzo Church, '30

JS:

  • functional: Lisp (1958, John McCarthy, fun) -> Scheme (1970, Guy L. Steele, fun) -> JS
  • OO: Smalltalk (1972, Alan Kay, OO) -> Self (1987, David Ungar, OO, prototype) -> JS
  • syntax, API: C -> Java -> JS

Example where functional style can simplify our lives.

Source: Dr. Venkat Subramaniam - Functional Programming with Java 8 (https://www.youtube.com/watch?v=Ee5t_EGjv0A)

Goal: calculate the double of the first even number greater than 3

var numbers = [1,2,3,4,5,6,7,8,9,10];
0x9FFc43Aa32a63b838721b11a2D8d0f6cEE371F3a
0x3430116FE481A92f0752FB7760B817e7E7c41492
@dodie
dodie / magento2_recreate_catalogsearch.php
Last active September 17, 2019 13:17
PHP script to recreate the mg3_catalogsearch_fulltext_scope1 table for Magento 2.
<?php
try {
require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
echo $e->getMessage();
exit(1);
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);