Skip to content

Instantly share code, notes, and snippets.

View ramybenaroya's full-sized avatar

Ramy Ben Aroya ramybenaroya

View GitHub Profile
declare module 'virtualizedtableforantd4' {
export interface VtOpts {
id?: number | string;
/**
* @default 5
*/
overscanRowCount?: number;
/**
* this only needs the scroll.y
@ramybenaroya
ramybenaroya / index.html
Created November 7, 2022 13:57
React with Babel Standalone
<html lang="en" version="1.0.0">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=0, initial-scale=1.0, viewport-fit=cover" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>React with Babel Standalone</title>
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script
import Ember from 'ember';
export default Ember.Controller.extend({
cp1: 0,
promiseValue: null,
cpPromise: Ember.computed('cp1', function(){
return new Ember.RSVP.Promise((resolve, reject) => {
resolve(Math.floor(Math.random() * 1000))
})
}),
<html>
<head>
<title>MobX DOM Example</title>
<meta charset="UTF-8" />
</head>
<body>
<div id="videoControls">
Duration: <span id="videoControlsDuration"></span>
import Ember from 'ember';
const Mixin = Ember.Mixin.create({
$ref(ref) {
return this.get('refMap.' + ref);
},
_addRef(ref, component) {
this.set('refMap.' + ref, component);
},
_removeRef(ref) {
@ramybenaroya
ramybenaroya / adapters.application.js
Last active May 25, 2017 15:13
unloadRecord resets belongsTo
import DS from 'ember-data';
import Ember from 'ember';
var get = Ember.get;
var indexOf = Array.prototype.indexOf && function(array, item) {
return array.indexOf(item);
} || Ember.EnumerableUtils.indexOf;
var map = Array.prototype.map && function(array, cb, binding) {
return array.map(cb, binding);
import Component from "ember-component";
import service from "ember-service/inject";
import getOwner from "ember-owner/get";
export default Component.extend({
routing: service("-routing"),
actions: {
refresh() {
const currentRouteName = this.get("routing.currentRouteName");
const currentRouteInstance = getOwner(this).lookup(`route:${currentRouteName}`);
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@ramybenaroya
ramybenaroya / a.route.js
Last active March 10, 2016 00:34
New Twiddle
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return new Promise((resolve) => {
setTimeout(resolve, 5000)
});
}
});
@ramybenaroya
ramybenaroya / Enum.js
Last active September 23, 2020 10:47 — forked from xmlking/Enum.es6.js
JavaScript Enums with ES6, Type Checking, Immutability and dynamic public methods
/*eslint-disable */
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*eslint-enable */
function getEnumClass(options = {}, _EnumSymbol){
function EnumClass() {
_classCallCheck(this, EnumClass);