Skip to content

Instantly share code, notes, and snippets.

@bekzod
bekzod / gist:68e8fc1c739745b6a5bdb12e99badfd4
Last active July 15, 2017 04:17
rsvp-vs-promise-then.js
var rsvp = require('rsvp');
class TestPromiseFromNative extends Promise {
then(onFulfillment, ...args) {
return super.then(result => isolate(onFulfillment, result), ...args);
}
}
class TestPromiseFromRSVP extends rsvp.Promise {
then(onFulfillment, ...args) {
import Ember from 'ember';
const { run } = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
func1() {
let log = function() {
console.log('boom!');
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
export function showInViewPort($el, tolarance, cb) {
if (!$el || !$el[0]) { return cb && cb(); }
tolarance = tolarance || 0;
var $body = $(document.body);
var topScrollAmount = $body.scrollTop();
var viewPortHeight = $(window).height();
var elY = $el.offset().top;
var elBottomY = elY + $el.height();
var topBounds = topScrollAmount + tolarance;
@bekzod
bekzod / format-currency.js
Last active February 5, 2016 08:53
format-currency
import Ember from 'ember';
const rates = {
'usd-gbp': 0.6666
}
const formatters = {
gbp(val){
return (Math.ceil(val / 5) * 5).toLocaleString();
}
{
"animation_enabled": false,
"auto_complete_commit_on_tab": true,
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
hideHomeButtonRoutes: ['index', 'login'],
isHomeButtonVisible: Ember.computed('currentRouteName', function(){
return this.get('hideHomeButtonRoutes').indexOf(this.get('currentRouteName')) === -1;
})
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@bekzod
bekzod / application.controller.js
Last active January 4, 2016 15:53
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
inputVal: 'hello',
actions: {
inputChange(val) {
this.set('inputVal', val);
}
}
});