Skip to content

Instantly share code, notes, and snippets.

View andyhot's full-sized avatar

Andreas Andreou andyhot

View GitHub Profile
@andyhot
andyhot / README.md
Created March 13, 2018 00:58 — forked from jacomyal/README.md
A problem with Function.prototype.bind polyfill

I met an issue with the common polyfill for Function.prototype.bind, found on the MDN, and I do not know where to fix it.

Here is the polyfill:

if (!Function.prototype.bind) {
  Function.prototype.bind = function(oThis) {
    if (typeof this !== 'function') {
      // closest thing possible to the ECMAScript 5
      // internal IsCallable function
 throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@andyhot
andyhot / components.my-form.js
Last active February 19, 2018 23:28 — forked from czosel/components.my-form.js
contextual components with inbound actions
import Ember from 'ember';
export default Ember.Component.extend({
children: [],
childCreated(component) {
this.children.push(component);
},
actions: {
reset() {
this.children.forEach(t=>t.send('reset'));
BsDropdown.reopen({
init() {
this._super(...arguments)
if (this.get('direction') === 'auto') {
this._autoDirection = true
}
},
actions: {
{
"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9": 7,
"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b": 14,
"d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35": 5,
"4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce": 7,
"4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a": 7,
"e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683": 1,
"b7a56873cd771f2c446d369b649430b65a756ba278ff97ec81bb6f55b2e73569": 1,
"624b60c58c9d8bfb6ff1886c2fd605d2adeb6ea4da576068201b6c6958ce93f4": 1,
"d59eced1ded07f84c145592f65bdf854358e009c5cd705f5215bf18697fed103": 2,
@andyhot
andyhot / components.my-component.js
Last active May 7, 2017 20:29
unit test component
import Ember from 'ember';
export default Ember.Component.extend({
result: {
headers: ['col'],
rows: [
{ columns: ['aa'] },
{ columns: ['bc'] },
{ columns: ['caa'] },
],
{{#each\s+([^\s]+)\s+in\s+([^\s]+)}}
{{#each $2 as |$1|}}
packages/container/lib/registry.js
:768 in deprecateResolverFunction [since: '2.3.0'] [id: 'ember-application.registry-resolver-as-function']
packages/container/lib/container.js
:147 lookupFactory review until field too [since: '2.12.0'] [id: 'container-lookupFactory']
:566 in injectDeprecatedContainer for getter of the defined property [since: '2.3.0'] [id: 'ember-application.injected-container']
:573 in injectDeprecatedContainer for setter of the defined property [since: '2.3.0'] [id: 'ember-application.injected-container']
:640 in buildFakeContainerFunction [since: '2.3.0'] [id: 'ember-application.injected-container']
packages/ember/lib/index.js
:219 in Ember.K definition [since: '2.12.0'] [id: 'ember-metal.ember-k']
@andyhot
andyhot / detect_globals.js
Created January 26, 2017 02:06
Script to list globals in a webpage - run in chrome
(function() {
var base_globals = ["speechSynthesis","caches","localStorage","sessionStorage","webkitStorageInfo","indexedDB","webkitIndexedDB","ondeviceorientationabsolute","ondeviceorientation","ondevicemotion","crypto","stop","open","alert","confirm","prompt","print","requestAnimationFrame","cancelAnimationFrame","requestIdleCallback","cancelIdleCallback","captureEvents","releaseEvents","getComputedStyle","matchMedia","moveTo","moveBy","resizeTo","resizeBy","getSelection","find","getMatchedCSSRules","webkitRequestAnimationFrame","webkitCancelAnimationFrame","webkitCancelRequestAnimationFrame","btoa","atob","setTimeout","clearTimeout","postMessage","setInterval","blur","clearInterval","focus","close","createImageBitmap","scroll","scrollTo","onpointerup","scrollBy","onpointerover","onpointerout","fetch","onpointermove","onpointerleave","webkitRequestFileSystem","onpointerenter","onpointerdown","webkitResolveLocalFileSystemURL","onpointercancel","openDatabase","customElements","onauxclick","performance","onunl
(function() {
var getAttachTo = Shepherd.Step.prototype.getAttachTo;
Shepherd.Step.prototype.getAttachTo = function() {
var opts = this.options.attachTo;
if (typeof opts.element === 'string') {
opts.element_backup = opts.element;
}