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
(ns benchmark-assoc.core
(:require [criterium.core :as crit]))
(defn no-assoc [items]
(apply hash-map (vec (flatten items))))
(defn assoc-all [items]
(apply assoc {} (vec (flatten items))))
(defn assoc-each-one [items]
@balinterdi
balinterdi / promise-utils-test.js
Last active February 16, 2022 12:26
Reimplementing RSVP.hash and RSVP.hashSettled with native promise functions
import {
promiseHash,
promiseHashSettled,
} from 'stock-ticker/utils/promise-utils';
import { module, test } from 'qunit';
module('Unit | Utility | promise-utils', function () {
module('#promiseHash', function () {
test('It works when all promises resolve', function (assert) {
assert.expect(2);
@balinterdi
balinterdi / rock-and-roll-ember-interview-questions.md
Last active May 27, 2021 12:42
The Rock & Roll with Ember band – Interview questions

These are the questions that can serve as a guide for the interview. You don't have to religiously adhere to them, though, so feel free to skip any or even come up with others you'd like to answer.

The easiest way for me to compose the interviews would be for you to fork this gist, add your name and your answers to the questions (right below each question) and send me the link to your gist.

  1. Could you introduce yourself in a few sentences?
  2. Which part of the world you are from?
  3. When and how did your Ember journey begin? How did you learn about the framework?
  4. How did reading the Rock & Roll with Ember book help you? Can you recall something that you learned from it?
  5. What Ember feature/RFC/etc. are you most excited about?
  6. Other than reading the book, how did you learn to “speak" Ember?
@balinterdi
balinterdi / application.hbs
Last active January 23, 2020 14:47
Refresh a route's @model – this one re-renders the template with the new song
<div class="h-screen w-full bg-blue-800 text-gray-100">
<div class="w-full xl:w-1/3 mx-auto">
<div class="h-12 flex items-center mb-4 border-b-2">
<h1 class="font-bold text-2xl">Rock & Roll <span class="font-normal">with Ember.js</span></h1>
</div>
<div class="w-full">
<div class="">
<ul>
{{#each @model as |song|}}
<li>
<script>
export let fill;
export let stroke;
export let strokeWidth;
export let rotation;
</script>
<svg viewBox="0 0 24 24" class="w-6" xmlns="http://www.w3.org/2000/svg">
<path
d="m11 14.59v-7.59a1 1 0 0 1 2 0v7.59l2.3-2.3a1 1 0 1 1 1.4 1.42l-4 4a1 1 0 0 1 -1.4 0l-4-4a1 1 0 0 1 1.4-1.42z"
@balinterdi
balinterdi / bubblesort.lua
Created July 12, 2019 17:22
A highly efficient bubble sort algorithm in Lua
function print_array(a)
local i = 1
while a[i] do
print(a[i])
i = i + 1
end
end
function bubblesort(t)
local swapsMade;
@balinterdi
balinterdi / ember-font-awesome.ts
Last active July 3, 2019 16:16
First stab at Embroider compat-adapter for ember-font-awesome
import V1Addon from '../v1-addon';
import { AddonMeta } from '@embroider/core';
export default class EmberFontAwesome extends V1Addon {
get packageMeta(): Partial<AddonMeta> {
let meta = super.packageMeta;
meta['public-assets'] = {
'node_modules/font-awesome/fonts/FontAwesome.otf': '/fonts/FontAwesome.otf',
};
for (let extension of ['eot', 'svg', 'ttf', 'woff', 'woff2']) {
@balinterdi
balinterdi / application.js
Created July 3, 2019 13:59
Setting document title in the application route
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({
currentUser: service(),
router: service(),
init() {
this._super();
this.setDocumentTitle();
@balinterdi
balinterdi / id_rsa.pub
Created December 4, 2018 13:29
Public SSH key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAnMnNV3Wonaxa0BHY5gTelsUpet1qRfEhzJUGN04tD1gXXAZnF+iDBQcw7g7600MS0OsXbiquQYiyqEhnnLpUv4fMmN+aEoqh20+smU6iKbHN2RwXwb7NRQ6kzHyQD+QC+/6MJjOsdjCibLmljMwGUh1MKw+AQ248cooSJdpHKqs=
@balinterdi
balinterdi / ga-events.js
Created March 4, 2016 20:40
Prevent GA to report too high of a bounce rate for your "one page at one visit" site (a landing page or a blog)
$.domReady(function(){
// Fire an event so that GA doesn't count it as a "bounce"
// http://blog.popcornmetrics.com/why-your-google-analytics-bounce-rate-is-wrong-and-how-to-fix-it/
function readPage() {
ga('send', {
'hitType': 'event',
'eventCategory': 'engagement',
'eventAction': 'read'
});
}