Skip to content

Instantly share code, notes, and snippets.

View astorm's full-sized avatar

Alana Storm astorm

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<style type="text/css">
body {background-color: #fff; color: #222; font-family: sans-serif;}
pre {margin: 0; font-family: monospace;}
a:link {color: #009; text-decoration: none; background-color: #fff;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse; border: 0; width: 934px; box-shadow: 1px 2px 3px #ccc;}
.center {text-align: center;}
.center table {margin: 1em auto; text-align: left;}
$ npx lerna clean -y
$ git clean -fdx
$ npm install
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
> husky@3.1.0 install /private/tmp/working/opentelemetry-js/node_modules/husky
> node husky install
$ npm install
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
> husky@3.1.0 install /path/to/opentelemetry-js/node_modules/husky
> node husky install
husky > Setting up git hooks
ENOENT: no such file or directory, mkdir 'node_modules/husky/.git/hooks'
<?php
define('nil', NULL);
function foo() {
return ["This is not go", nil];
}
list($value, $err) = foo();
var_dump($value, $err);
//app/code/[YourNamespace]/Commercebug/view/base/web/js/commercebug.js
//replace this
//$('#commercebug-tab-content .pulsestorm-data-table').DataTable();
//with this
$('#commercebug-tab-content .pulsestorm-data-table').DataTable({
"aaSorting": []
});
<?php
class Foo
{
protected $default='default';
public function test()
{
$this->default = 'not default';
echo $this->addChild(),"\n";
}
@astorm
astorm / Example.md
Last active January 26, 2016 16:41

We kick off a program with this

requirejs(['Pulsestorm_RequireExample1/example'],function(example){
    alert(example.message);
});

This program uses the javascript module named Pulsestorm_RequireExample1/example.

Something in Magento 2 converts Pulsestorm_RequireExample1/example into

[2015-12-02 01:09:10][INFO] EXTENSION: Vendor_ExtensionName Warning:  file_get_contents(/Users/alanstorm/Sites/magento-2-with-keys/magento2//app/code/Magento/Checkout/CartController.php): failed to open stream: No such file or directory in /Users/alanstorm/Documents/github/unirgy/convertm1m2/ConvertM1M2.php on line 2065
PHP Stack trace:
PHP   1. {main}() /Users/alanstorm/Documents/github/unirgy/convertm1m2/ConvertM1M2.php:0
PHP   2. ConvertM1M2->convertAllExtensions() /Users/alanstorm/Documents/github/unirgy/convertm1m2/ConvertM1M2.php:48
PHP   3. ConvertM1M2->_convertExtensionStage1() /Users/alanstorm/Documents/github/unirgy/convertm1m2/ConvertM1M2.php:282
PHP   4. ConvertM1M2->_convertAllControllers() /Users/alanstorm/Documents/github/unirgy/convertm1m2/ConvertM1M2.php:319
PHP   5. ConvertM1M2->_convertController() /Users/alanstorm/Documents/github/unirgy/convertm1m2/ConvertM1M2.php:2196

PHP 6. ConvertM1M2->_convertCodeObjectManagerToDI() /Users/alanstorm/Documents/github/u

//calling test1 will **not** define a function you can call in the global scope
//functions defined in eval are scoped to the function they're called from
function test1()
{
eval('function boo(){alert("No one can call me.")}');
}
boo(); //boo() is not defined error
//calling test2 **will** define a function you can call in the global scope
//the window object and the global scope are the same things in javascript
$ lsof -i | grep squid
squid     8012 alanstorm    7u  IPv6 0x313e2987c9c301cd      0t0  UDP *:56286
squid     8012 alanstorm    8u  IPv4 0x313e2987cc8d23bd      0t0  UDP *:49908
squid     8012 alanstorm   10u  IPv6 0x313e2987f16a8ae5      0t0  TCP 10.0.1.3:ndl-aas->10.0.1.12:50230 (ESTABLISHED)
squid     8012 alanstorm   11u  IPv6 0x313e2987f16a85e5      0t0  TCP *:ndl-aas (LISTEN)
squid     8012 alanstorm   13u  IPv4 0x313e2987ee85ba55      0t0  TCP 10.0.1.3:51856->17.173.66.133:https (ESTABLISHED)