This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Experiment do | |
def pi( data \\ %{total: 0, circle: 0}, num_points) do | |
%{total: total, circle: circle} = data | |
case num_points do | |
num_points when num_points == 0 -> | |
4 * circle/total | |
num_points -> | |
:math.pow(:rand.uniform, 2) + :math.pow(:rand.uniform, 2) | |
|> case do | |
x when x <= 1 -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
import Changeset from "ember-changeset"; | |
import {tracked} from "@glimmer/tracking"; | |
import {action, get, computed, defineProperty} from "@ember/object"; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
get __val(){ | |
return get(this.model, "greeting.de") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
export default class extends Component { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
test: "no", | |
init(){ | |
this._super(...arguments) | |
this.set("test2", "hi2") | |
}, | |
didReceiveAttrs(){ | |
console.log(this.test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import JSONAPIAdapter from "ember-data/adapters/json-api"; | |
import { assert } from '@ember/debug'; | |
export default JSONAPIAdapter.extend({ | |
query(store, modelClass, query, _, options = {}) { | |
assert("No options supplied", Object.keys(options).length) | |
// If you now remove this: "._super" from this comment, the options will be passed. | |
return {data:[]} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import JSONAPIAdapter from "ember-data/adapters/json-api"; | |
import { assert } from '@ember/debug'; | |
export default JSONAPIAdapter.extend({ | |
host: "https://baconipsum.com", | |
query(store, modelClass, query, _, options = {}) { | |
assert(options.adapterOptions, "Options are not passed") | |
const res = this._super(...arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import JSONAPIAdapter from "ember-data/adapters/json-api"; | |
import { get, computed } from "@ember/object"; | |
import { inject as service } from "@ember/service"; | |
const captureQuery = () => { | |
return function(store, type, query, options) { | |
console.error({ options }, {query}); | |
return this._super(...arguments); | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import EmberObject from '@ember/object'; | |
import Changeset from 'ember-changeset'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
init(){ | |
this._super(...arguments) | |
let tom = this.store.createRecord('test') | |
NewerOlder