Skip to content

Instantly share code, notes, and snippets.

Enjoying life, including work.

Balint Erdi balinterdi

Enjoying life, including work.
Block or report user

Report or block balinterdi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

How to use positionalParams in Angle Bracket invocation

A component with positionalParams always also has named versions of its parameters. For example, the liquid-if component from liquid-fire has this in its Javascript file:

positionalParams: ['predicate']

So these are equivalent:

runspired / push-deletion.js
Last active May 10, 2019
Useful Ember Data helpers
View push-deletion.js
notifying the store that a record has been remotely deleted and should be fully removed.
function pushDeletion(store, type, id) {
let record = store.peekRecord(type, id);
if (record !== null) {
let relationships = {};
let hasRelationships = false;
View push-mirage-db-into-store.js
// tests/helpers/push-mirage-db-into-store.js
import { registerAsyncHelper } from '@ember/test';
import { run } from '@ember/runloop';
let pushMirageDbIntoStore = function(server, store) {
let tables = Object.keys(server.schema);
tables.forEach(table => {
if (server.schema[table].all) {
let all = server.schema[table].all();
wojteklu /
Last active Sep 17, 2019
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.

General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

ef4 / select.hbs
Last active Jun 7, 2017
Goodbye old Select View
View select.hbs
<select onchange={{action (mut vehicle) value="target.value"}}>
{{#each vehicles key="@item" as |vehicleChoice|}}
<option value={{vehicleChoice}} selected={{eq vehicle vehicleChoice}}>{{vehicleChoice}}</option>
mars / gist:6086194
Last active Dec 20, 2015
DEPRECATED see comments: ember-testing: select an option (helper)
View gist:6086194
function(app, selector, value, description) {
// choose an option
// trigger the change
// assert the selected option
equal(find(selector+" option:selected").val(), value, description||"makes the selection");
// promise
return wait();
lukemelia / buffered_proxy.js
Last active May 5, 2016
Buffered Proxy, extracted from Yapp codebase
View buffered_proxy.js
var empty, get, set,
__hasProp = {}.hasOwnProperty;
get = Ember.get;
set = Ember.set;
empty = function(obj) {
var key;
for (key in obj) {
if (!, key)) continue;
richhickey / mapperf.clj
Created Dec 12, 2012
twiddling with map perf
View mapperf.clj
(ns bitmapmap-test.core-test
(:use clojure.test))
#_(defn bitmap-map
"Constructs a bitmap-map. If any keys are equal, they are handled as
if by repeated uses of assoc."
{:added "1.6"
:static true}
([] (. clojure.lang.PersistentBitmapMap EMPTY))
([& keyvals]
arnab / controller.rb
Last active Jun 5, 2018
Allow & test CORS requests in Rails
View controller.rb
before_filter: allow_cors_requests
def allow_cors
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE}.join(",")
headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(",")
head(:ok) if request.request_method == "OPTIONS"
# or, render text: ''
# if that's more your style
You can’t perform that action at this time.