Skip to content

Instantly share code, notes, and snippets.

@22a
22a / components.my-component\.js
Created July 27, 2020 13:42
tracked-property-index
import Component from '@ember/component';
import EmberObject, { computed } from '@ember/object';
export default Component.extend({
nums: undefined,
errors: undefined,
init() {
this._super(...arguments);
this.set('nums', [1,2,3,4,5]);
@22a
22a / index.js
Last active October 26, 2018 14:54
tcd <-> inter.com mentoring - high-low card game
// importing readline library - basically a scanner equivalent
const readlineSync = require('readline-sync');
// define our number of guesses required to win as a constant
const winningNumberOfGuesses = 4;
// define a function that takes an integer card number and returns the english
// name string for that card 2->"2", 10->"Jack", etc.
// how you implement this doesn't matter all that much - here I've defined a
// hash of number to card name pairs and used the funtion's cardNum parameter
import Ember from 'ember';
export default Ember.Component.extend({
});
@22a
22a / minesweeper.js
Created November 20, 2017 22:23
Functional Katas, Token! 20-11-2017
const rows = 4
const columns = 4
const field = [
['*', '.', '.', '.'],
['.', '.', '.', '.'],
['.', '*', '.', '.'],
['.', '.', '.', '.']
]
@22a
22a / runlength.ex
Created June 8, 2017 23:45
Functional Katas, Elixir Special! 8-6-2017
defmodule Runlength do
def encode(string) do
String.codepoints(string)
|> List.foldl([], &count/2)
|> List.foldr("", &format/2)
end
defp count(char, [{char,n}|tail]) do
[{char, n+1}|tail]
end

Keybase proof

I hereby claim:

  • I am 22a on github.
  • I am 22a (https://keybase.io/22a) on keybase.
  • I have a public key whose fingerprint is 41EB 5ACE E3F8 7739 2F91 1864 DF7C 74AF DC99 DF7C

To claim this, I am signing this object: