Skip to content

Instantly share code, notes, and snippets.

View patrickberkeley's full-sized avatar

Patrick Berkeley patrickberkeley

View GitHub Profile
@runspired
runspired / controllers.-base\.js
Last active January 12, 2023 21:42
Query Params Service
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class extends Controller {
@service('query-params') params;
// queryParams = this.params.buildControllerParams('application', {
// composeWith: [this.params.getDatatableParams('controls')]
// });
}
@vasind
vasind / ember-cli-build.js
Last active June 8, 2023 04:33
Ember CLI performance improvements and tips
// Credits to the following posts that helps me to reduce build times drastically
// https://discuss.emberjs.com/t/tips-for-improving-build-time-of-large-apps/15008/12
// https://www.gokatz.me/blog/how-we-cut-down-our-ember-build-time/
//ember-cli-build.js
let EmberApp = require('ember-cli/lib/broccoli/ember-app');
let env = EmberApp.env(),
@RomkeVdMeulen
RomkeVdMeulen / prop-decorator.ts
Last active June 26, 2020 14:01
How to change instance properties through decorators in TypeScript: http://romkevandermeulen.nl/2018/01/24/typescript-property-decorators.html
function makePropertyMapper<T>(prototype: any, key: string, mapper: (value: any) => T) {
const values = new Map<any, T>();
Object.defineProperty(prototype, key, {
set(firstValue: any) {
Object.defineProperty(this, key, {
get() {
return values.get(this);
},
set(value: any) {
values.set(this, mapper(value));
@arenoir
arenoir / address_adapter.js
Created June 20, 2017 17:22
Address adapter unload existing record on create.
import Ember from 'ember';
import ApplicationAdapter from 'adapters/application';
const {RSVP, run} = Ember;
export default ApplicationAdapter.extend({
//unloads existing record if create record returns a duplcate.
createRecord(store, type, snapshot) {
let saving = this._super(store, type, snapshot);
@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active April 21, 2023 17:14
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@dustinfarris
dustinfarris / circle.yml
Last active February 14, 2017 19:48
CircleCI script for Ember-CLI projects
machine:
node:
version: 0.10.28
dependencies:
pre:
- npm install -g bower
override:
- npm i
- bower i
deployment:
@fenbox
fenbox / gulpfile.js
Created December 29, 2013 11:48
sample gulp config: gulpfile.js
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var lr = require('tiny-lr'),
refresh = require('gulp-livereload'),
server = lr();
@wrobstory
wrobstory / README.md
Last active March 28, 2023 02:44
D3 Brush and Tooltip Complete

Example for Cooperative Brushing and Tooltips in D3.

The completed chart, with both tooltips and brushing working cooperatively. You can start a brush-zoom on either the background or a data point.

@adamico
adamico / collection_check_boxes_input.rb
Last active April 28, 2020 15:12 — forked from mattclar/simple_form.rb
This fork adds a custom horizontal form wrapper and merges append/prepend in a 'group' wrapper
#app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput
def item_wrapper_class
"checkbox-inline"
end
end
@Xanmia
Xanmia / index.html
Created July 25, 2013 13:35
A CodePen by Xanmia. 2d Easy Star Field - Animated rotating star field using the canvas element only. Random locations, opacity and speed of stars. As well as a shooting star from time to time.
<canvas id="field"></canvas>