Skip to content

Instantly share code, notes, and snippets.

View ksol's full-sized avatar
🏠
Working from home, most of the time

Kevin Soltysiak ksol

🏠
Working from home, most of the time
  • Scalingo
  • Strasbourg, France
  • 20:36 (UTC +01:00)
  • X @ksol
View GitHub Profile
@ksol
ksol / etcd.rb
Created January 13, 2021 09:46
etcd 3.1.7
class Etcd < Formula
desc "Key value store for shared configuration and service discovery"
homepage "https://github.com/coreos/etcd"
url "https://github.com/coreos/etcd/archive/v3.1.7.tar.gz"
sha256 "41cbfc6744c76aa1735e11c82e6f6ff03c88dc88810938cf6eb80930dc994b2a"
head "https://github.com/coreos/etcd.git"
depends_on "go" => :build
def install
Ember.Route.reopen({
activate: function() {
var cssClass = this.toCssClass();
// you probably don't need the application class
// to be added to the body
if (cssClass !== 'application') {
Ember.$('body').addClass(cssClass);
}
},
deactivate: function() {
import ApplicationAdapter from './application';
import UrlTemplates from "ember-data-url-templates";
export default ApplicationAdapter.extend(UrlTemplates, {
updateRecordUrlTemplate: '{+host}/posts/{id}{/updateEndpoint}',
urlSegments: {
updateEndpoint(type, id, snapshot) {
return snapshot.get('_updateEndpoint');
}
import ApplicationAdapter from './application';
import UrlTemplates from "ember-data-url-templates";
export default ApplicationAdapter.extend(UrlTemplates, {
updateRecordUrlTemplate: '{+host}/posts/{id}{/updateEndpoint}',
urlSegments: {
updateEndpoint(type, id, snapshot) {
return snapshot.get('_updateEndpoint');
}
import Ember from "ember";
import DS from "ember-data";
export default DS.Model.extend({
// Your ED relationships and properties here...
// ...
// Custom API
upvote() {
this.set('_updateEndpoint', 'upvote');
import ApplicationAdapter from './application';
import UrlTemplates from "ember-data-url-templates";
export default ApplicationAdapter.extend(UrlTemplates, {
queryUrlTemplate: '{+host}/posts/{endpoint}',
urlSegments: {
endpoint(type, id, snapshot, query) {
// we're extracting the endpoint from the query object...
let ep = query.endpoint;
import ApplicationAdapter from './application';
import Ember from 'ember';
import UrlTemplates from "ember-data-url-templates";
const get = Ember.get;
export default ApplicationAdapter.extend(UrlTemplates, {
adapterContext: Ember.service.inject(),
queryUrlTemplate: Ember.computed('adapterContext.{company,organization}', function() {
// adapters/comment.js
import ApplicationAdapter from './application';
import Ember from 'ember';
import UrlTemplates from "ember-data-url-templates";
export default ApplicationAdapter.extend(UrlTemplates, {
urlTemplate: "{+host}/posts/{postId}/comments{/id}",
adapterContext: Ember.inject.service(),
import Ember from 'ember';
export default Ember.Service.extend({
// Properties
post: null,
aParentObject: null,
anotherParentObject: null,
// API
setContext(obj = {}) {
import UrlTemplates from "ember-data-url-templates";
export default DS.RESTAdapter.extend(UrlTemplates, {
urlTemplate: '{+host}/posts/{postId}/comments{/id}',
findUrlTemplate: '{+host}/comments/{id}',
createRecordUrlTemplate: '{+host}/users/{userId}/comments',
currentUser: Ember.inject.service(),
urlSegments: {