Skip to content

Instantly share code, notes, and snippets.

View kimroen's full-sized avatar

Kim Røen kimroen

View GitHub Profile
@kimroen
kimroen / machine.js
Created August 12, 2020 14:37
Generated by XState Viz: https://xstate.js.org/viz
const initialContext = {
file: 'NO VALUE',
success: 'NO VALUE',
direction: 1,
error: 'NO VALUE',
validationError: 'NO VALUE',
};
const UploadMachine = Machine({
id: 'upload',
@kimroen
kimroen / machine.js
Last active June 12, 2020 12:50
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import Component from '@ember/component';
import { observer } from '@ember/object';
import DynamicTable from '../../mixins/ember-light-table-data-mixin';
export default Component.extend(DynamicTable, {
sort: '',
dir: '',
isLoading: true,
onDataTableLoad: observer('dataTable', function() {
import Component from '@ember/component';
import { observer } from '@ember/object';
import DynamicTable from '../mixins/ember-light-table-data-mixin';
export default Component.extend({
sort: '',
dir: 'asc',
isLoading: true,
onDataTableLoad: observer('dataTable', function() {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
columns: Ember.computed(function () {
return [
{
label: 'OrderId',
valuePath: 'orderId',
align: 'right',
import Component from '@ember/component';
import move from 'ember-animated/motions/move';
import scale from 'ember-animated-motions/scale';
import { parallel } from 'ember-animated';
export default Component.extend({
showThing: false,
transition: function * ({ receivedSprites, sentSprites }) {
receivedSprites.forEach(parallel(scale, move));
import Ember from 'ember';
import move from 'ember-animated/motions/move';
import opacity from 'ember-animated/motions/opacity';
import { easeOut, easeIn } from 'ember-animated/easings/cosine';
import Promise from 'rsvp';
export default Ember.Component.extend({
myProperty: false,
transition: function* ({ insertedSprites, keptSprites, removedSprites, duration }) {
@kimroen
kimroen / rspec_model_testing_template.rb
Last active July 9, 2022 21:45 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
#!/bin/bash
# Let's get some color going!
red=$'\e[1;31m'
grn=$'\e[1;32m'
end=$'\e[0m'
# cd to cwd of the script (presumably in it's proper location)
cd "$(dirname "$0")"
printf "\nInstalling Sketch templates..."
@kimroen
kimroen / controllers.application.js
Last active August 29, 2015 14:28
Basic QueryParams
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
queryParams: ['name'],
name: 'Kim'
});