Skip to content

Instantly share code, notes, and snippets.

View balinterdi's full-sized avatar
👌
Enjoying life, including work.

Balint Erdi balinterdi

👌
Enjoying life, including work.
View GitHub Profile
@lifeart
lifeart / component.js
Created February 6, 2020 14:42
Ember Cp Validations Octane
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import Object from "@ember/object";
import { reads } from "@ember/object/computed";
import { validator, buildValidations } from "ember-cp-validations";
import { getOwner } from "@ember/application";
const Validations = buildValidations({
billing_first_name: {
descriptionKey: "form.fields.billing_first_name",
@rafaltrojanowski
rafaltrojanowski / VSCode
Last active September 26, 2019 07:37
Vim -> VSCode migration
1. Install vscodevim
2. Run from terminal:
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false # Key repeat
3. jj:
Add to settings.json:
"vim.insertModeKeyBindings": [
{
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

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
runspired / push-deletion.js
Last active September 20, 2022 18:44
Useful Ember Data helpers
/*
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;
// 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
wojteklu / clean_code.md
Last active April 24, 2024 12:26
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
ef4 / select.hbs
Last active October 7, 2021 09:41
Goodbye old Select View
<select onchange={{action (mut vehicle) value="target.value"}}>
{{#each vehicles key="@item" as |vehicleChoice|}}
<option value={{vehicleChoice}} selected={{eq vehicle vehicleChoice}}>{{vehicleChoice}}</option>
{{/each}}
</select>
@mars
mars / gist:6086194
Last active December 20, 2015 06:29
DEPRECATED see comments: ember-testing: select an option (helper)
Ember.Test.registerHelper('selectFrom',
function(app, selector, value, description) {
// choose an option
find(selector).val(value);
// trigger the change
find(selector).change();
// assert the selected option
equal(find(selector+" option:selected").val(), value, description||"makes the selection");
// promise
return wait();