HN user

AndrewHampton

915 karma

[ my public key: https://keybase.io/andrewhampton; my proof: https://keybase.io/andrewhampton/sigs/8ov2hJUPVQGL1VkZ-q-IkdcaOUSMeyA6E-G939rCCzk ]

Posts23
Comments146
View on HN
github.com 5mo ago

Ruby Prism Skill – CLI skill for understanding Ruby files

AndrewHampton
3pts1
www.akshaykhot.com 2y ago

Content Security Policy (CSP): What Every Web Developer Must Know

AndrewHampton
2pts0
phoboslab.org 8y ago

About Coinhive

AndrewHampton
3pts0
github.com 11y ago

Docker Compose (aka fig) Released

AndrewHampton
15pts1
www.wired.com 11y ago

President Obama Is Waging a War on Hackers

AndrewHampton
2pts2
groups.google.com 11y ago

Vagrant 1.7.0 Released

AndrewHampton
2pts1
www.washingtonpost.com 13y ago

Twitter hacked, prompting flood of password reset e-mails

AndrewHampton
6pts2
web-design-weekly.com 14y ago

The Best of the Best Boilerplates/Bootstraps

AndrewHampton
3pts0
www.twitch.tv 14y ago

Notch Live Streaming 0x10c

AndrewHampton
6pts0
asia.cnet.com 14y ago

New Internet Explorer will come in two flavors

AndrewHampton
1pts0
andrewhampton.posterous.com 14y ago

MongoDB and Software Version Numbers

AndrewHampton
1pts1
news.cnet.com 15y ago

Sony to restore PSN services, compensate customers

AndrewHampton
1pts0
www.breitbart.com 15y ago

NYC judge calls off plans for Google library

AndrewHampton
1pts0
www.phoboslab.org 15y ago

Impact (Javascript Game Engine) Sales Report

AndrewHampton
57pts11
news.cnet.com 15y ago

Google requests delay of new Google TVs

AndrewHampton
1pts0
news.ycombinator.com 15y ago

Show HN: Top Comment Highlighter

AndrewHampton
8pts2
www.today.msnbc.msn.com 15y ago

Interesting Navigation Elements Next to the Scrollbar on MSN.com

AndrewHampton
1pts0
groups.google.com 15y ago

Node.js 2.2 released

AndrewHampton
3pts2
news.yahoo.com 15y ago

French Senate passes ban of full Muslim veils

AndrewHampton
1pts0
venturebeat.com 15y ago

Reddit ‘excited’ about chance to eat Digg’s lunch

AndrewHampton
32pts23
hacks.mozilla.org 16y ago

Firefox will support VP8 (aka WebM)

AndrewHampton
83pts16
news.cnet.com 16y ago

Google may exit China on 4/10

AndrewHampton
4pts1
www.nytimes.com 17y ago

Character Encoding Issues with China's New ID System

AndrewHampton
2pts0

I love web components. The one thing I really wish browsers supported though was a per-site custom element registry that persisted across page loads.

Give me 10mb and an API like service workers have to manage a library of custom elements that can be used on my site as soon as the page loads.

We've been experimenting with various skills and MCPs in our day-to-day Ruby development at Poll Everywhere. This is the internal skill that's been most useful for preserving the context window while letting agents explore Ruby code.

It's a CLI wrapper around Ruby's Prism gem that lets the agent do this:

  $ prism -o app/models/user.rb

  User < ApplicationRecord [1-75]
    includes Agreeable
    includes Auditable
    has_many :polls
    has_many :questions, through: :polls
    has_many :votes
    has_many :reports, dependent: :destroy
    #audit_create [41-43]
    #allowed_to_participate_in?(poll) [45-66]
    #restricted_from_participation_in?(poll) [68-70]
    #recently_created? [72-74]

  $ prism -m 'recently_created?' app/models/user.rb

  === METHOD: recently_created? ===
  Lines 72-74:
    def recently_created?
      created_at.after?(5.minutes.ago)
    end
The idea is to give the agent a token-efficient way to understand what's going on in Ruby code.
Ian's Shoelace Site 6 months ago

Back in 2004, while bored in my college dorm, I learned the Ian Knot from this site. I've used it ever since. A few weeks ago, my 10 year old decided it was time to learn how to tie his shoes "dad's way". I was pleasantly surprised to see the site was still up, so I used it to help teach him how to do it.

Part of me wonders if I should be on ozempic since I have a family history of several of the issues it's reported to help with.

Another part of me wonders if all the ozempic headlines I've seen over the past few months are just an incredibly effective and well orchestrated ad campaign.

Triptych Proposals 2 years ago

What HTTP method would you expect the second example to use? `GET /users/delete?id=354`?

The first has the advantage of being a little clearer at the HTTP level with `DELETE /users/354`.

Yeah, I use about a dozen git aliases in my normal workflow. In case it's helpful, here are the relevant ones for this flow:

  alias git_main_branch='git rev-parse --abbrev-ref origin/HEAD | cut -d/ -f2'
  alias gapa='git add --patch'
  alias grbm='git rebase -i --autosquash $(git_main_branch)'
  alias gfx='git commit --fixup $(git log $(git_main_branch)..HEAD --oneline| fzf| cut -d" " -f1)'
Another favorite is:
  alias gmru="git for-each-ref --sort=-committerdate --count=50 refs/heads/ --format='%(HEAD) %(refname:short) | %(committerdate:relative) | %(contents:subject)'| fzf | sed -e 's/^[^[[:alnum:]]]*[[:space:]]*//' | cut -d' ' -f1| xargs -I _ git checkout _"
gmru (git most recently used) will show you the branches you've been working on recently and let you use fzf to select one to check out.

This was 100% my inspiration. I used emacs+magit for years. After switching away from emacs for dev work, I still cracked it open for git interactions for another year or so. Eventually, I moved entirely to the shell with a bunch of aliases to replicate my magit workflow.

Yeah, it's definitely less powerful that what absorb is doing. I wasn't trying to argue that it was equivalent. I just wanted to share a bash one-liner that I've had success with in case others find it helpful.

What if I want some parts of it into one commit and another parts into another?

Looks like absorb will automatically break out every hunk into a separate fixup commit. My one-liner will create 1 fixup commit for everything that's staged. That's typically what I need, but on the occasions it's not, I use `git add -p`, as kadoban mentioned, to stage exactly what I want for each commit.

FWIW, I've been using this alias for the past couple years for fixup commits, and I've been happy with it:

gfx='git commit --fixup $(git log $(git merge-base main HEAD)..HEAD --oneline| fzf| cut -d" " -f1)'

It shows you the commits on the current branch and lets you select one via fzf. It then creates the fixup commit based on the commit you selected.

A team I worked with in the past came to the same conclusion - turning authorization rules into WHERE clauses is a very efficient way to solve this problem, if you can figure out a clean way to do it.

For rails specifically, https://github.com/polleverywhere/moat was built with this in mind. It's heavily inspired by Pundit, but let's you write policies at the `ActiveRecord::Relation` level. So `policy_filter(Article).find_by!(id: params[:id])` would run something like `select * from articles where id = ? and id in (select id from articles where owner_id = ?);`.

Another option would be for the B to dispatch a `CustomEvent` on itself. That event will bubble up the DOM until it hits A. A would then need an event listener that would probably stop propagation and do whatever bookkeeping is necessary.

I never used the old trending page, but it sounds like the Changelog Nightly newsletter [1] is basically the same thing. It goes out every day at 9PM Pacific. It has 3 sections:

- most starred repositories that haven't been in the newsletter before

- most starred repositories that were created that day

- most starred repositories

1: https://changelog.com/nightly

We've been following conventional commits for our front end code for the last year or so at my work. In other repositories, we've loosely followed the keep a change log conventions. I find conventional commits great when your repository will produce a package to be consumed by others. For example, conventional commits for our shared JS code helps us produce great change logs and helps us easily follow semver for the NPM packages our other applications use.

However, I don't find it that useful in the the final applications, even counter productive, since it typically will take up quite a bit of space in the commit title. Many of our front end devs completely ignore title length conventions now.

This reminds me of a story one of my college professors told about the days when he helped automate factories in the 80s. Every night, the control server hey installed would go offline around 1am then come back up a few minutes later. It was never the exact same time or duration. After a few days of diving through the code with no progress, one of his co-workers decided to stay up all night at the factory and just watch the server. Around 1am, the cleaning lady came in, unplugged the server and plugged in her vacuum.