Skip to content

Instantly share code, notes, and snippets.

View amiel's full-sized avatar

Amiel Martin amiel

View GitHub Profile
▐▛███▜▌ Claude Code v2.1.85
▝▜█████▛▘ Opus 4.6 (1M context) · Claude Max
▘▘ ▝▝ ~/src/bento/venice
❯ /clear
⎿  (no content)
❯ Help me understand how the assignment/coercion lifecycle works for the
duration type in ActiveRecord. Campaign#delivery_limit_period is a postgres
interval type, which is coerced in Rails to an ActiveSupport::Duration. For the
@amiel
amiel / aurora-forecast.sh
Created August 19, 2022 22:58
Aurora Forecast for Fairbanks, AK
#!/bin/bash
# This takes the maximum forecast between four points surrounding Fairbanks, AK.
# Paste this in to https://geojson.io/#map=9/64.5053/-147.4997 to see what those points are.
# { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -147, 65 ]}, "properties": {} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -147, 64 ]}, "properties": {} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -148, 65 ]}, "properties": {} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -148, 64 ]}, "properties": {} } ] }
JQ=$(cat <<-JQ
{
forecast_time: ."Forecast Time" | fromdateiso8601 | strflocaltime("%H:%M (%Z)"),

urlTemplate Proposal

Summary

urlTemplate improves the extesibility of API endpoint urls in RESTAdapter.

Motivation

I think that Ember Data has a reputation for being hard to configure. I've often heard it recommended to design the server API around what Ember Data expects.

var controller = this;
var success = function(model) {
controller.transitionToRoute('...');
};
var failure = function(xhr) {
controller.get('model').rollback();
if (xhr.status == 400) {
controller.showError($.parseJSON(xhr.responseText).detail);
@amiel
amiel / serializers-application.coffee
Created August 6, 2014 20:47
Example serializer for supporting the lack of a root key
ApplicationSerializer = DS.RESTSerializer.extend
extract: (store, type, payload, id, requestType) ->
newPayload = {}
newPayload[type.typeKey] = payload
@_super store, type, newPayload, id, requestType
serializeIntoHash: (hash, type, record, options) ->
Ember.merge hash, @serialize record, options
@amiel
amiel / 1-other-versions.txt
Last active August 29, 2015 14:03
Npm list in ember.js -- tests in browser are failing because {{FEATURES}} is not getting replaced in tests/ember_configuration.js
$ npm --version
1.3.21
$ ember --version
version: 0.0.37

This works with Ember Data 1.0.0-beta.7+canary.b45e23ba, but not Ember Data 1.0.0-beta.8.2a68c63a.

normalizePayload now takes just a payload.

What is the new way to do this?

@amiel
amiel / admin_user_spec.rb
Created May 20, 2014 18:25
spec/features/admin_user_spec.rb
require 'spec_helper'
describe 'Users' do
fixtures :all
let(:user) { admin_users(:amiel) }
before { login_to_admin }
describe '#index' do
it 'renders without fail' do
visit '/admin/users'
@amiel
amiel / example.js
Created May 14, 2014 21:23
Example gist cursor misalignment.
Object.create({ braces: { make: { it: { slightly: { worse: { each: { time: {} } } } } } } });
return { cursor: "is basically one character off here" };
@amiel
amiel / IDEAS.md
Created May 13, 2014 20:38
nested urls ideas