Profile cover photo
Profile photo
Justin Fagnani
978 followers
978 followers
About
Justin Fagnani's posts

Post has shared content
My response to the new app icons in Android 7.0
Photo

Post has attachment
I wrote a post on how class expressions enable real mixins in JavaScript, and why they're better than previous mixin approaches.

Post has attachment
ES6 class expressions are super powerful, and enable real mixins without any libraries at all. I wrote a blog post on how this works and why it's much better than the mixins we see in use today. I hope that this pattern catches on so that we can have common and compatible mixins across the whole JS ecosystem.

http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/

Post has shared content
Debate notes.

Well, here we are again. It seems like it’s been so long! This is the final debate of the year, as CNN really, really wants you to know, given how often they keep saying it.

At this point in the 2012 cycle, Newt Gingrich led the Republican field by ten points and was clearly the nominee-in-waiting.

At this point in the 2008 cycle, Hillary Clinton, the inevitable nominee, was crushing Barack Obama by eighteen points, which is why we never heard about that guy again. Rudy Giuliani was the leader on the GOP side, his strategy of “a noun, a verb, and 9/11” catapulting him to certain victory.

And, of course, Howard Dean was in the lead at this point in the 2004 cycle.

We go into this debate with Donald Trump the frontrunner, and Ted Cruz nipping at his heels. But first, we have a junior varsity event, starring Lindsey Graham, George Pataki, Rick “Man on Dog” Santorum, and Mike Huckabee. Oh, and Sarah Palin is in the audience, so there’s that.

§

“Kill every one of those bastards we can find!” —Lindsey Graham

Fearmongering. BE AFRAID! All the candidates want you to know it’s time to cower in the corner, quivering with fear. War! We’re at WAR! Lindsey Graham has been to Iraq and/or Afghanistan thirty-six times, he wants you to know, and we’re all gonna die!! if we don’t elect him. Or Rick “Man on Dog” Santorum, who wants you to know World War 3 has begun and we’re all gonna die!! because Barack Obama is basically a member of ISIS. “We’re at war, folks,” Sen. Graham said. “They’re trying to kill us all.”

Lindsey Graham really, deeply, desperately wants US troops in Syria. Over and over, he hammered away at it. Boots on the ground! “Fight them over there, or they’re coming here,” he said. “They’re planning another 9/11 as we speak.” BE AFRAID! And don’t you dare forget about his thirty-six visits to Iraq and/or Afghanistan! Thirty-six! Also, he misses George W. Bush, who somehow, inexplicably, now has a 67% approval rating among Republicans.

One thing the JV candidates agree on: Donald Trump would be a terrible choice. The gloves came off, and they left no question as to how they feel about him. Mr. Trump was attacked more than anyone else except Barack Obama. Egged on by the moderators starting every question with “Donald Trump says…” they piled on. Oh, except Mr. Man on Dog, who thinks that what Mr. Trump said was “nothing against Muslims”, and that while Trump’s proposal was perhaps not entirely perfect, he raises a legitimate issue. It was twenty minutes before a non-Trump question was asked.

Mr. Graham wants you to stop thinking Muslims are the enemy. Muslims even serve in the US military, he pointed out. But Mr. Huckabee and Mr. Santorum insist that Islam isn’t even protected by the First Amendment.

The pundits thought the rise of Ted Cruz would lead the JV candidates to begin attacking him. He was hardly mentioned.

§

The main Hunger Games event is down to just nine tributes, and Rand Paul made it in by the skin of his teeth. Donald Trump stands center-stage. Chris Christie escaped junior varsity and is back in the main group. Jeb Bush is still there, like the lingering sore throat after a cold.

Rand Paul said in his opening statement that we defeat terrorists by showing them we’re not afraid of them, possibly the most sensible thing we’ll hear all night.

If you thought the main event might tone down the fearmongering, you’d be disappointed. Chris Christie used his opening statement to tell us that mothers taking their kids to the bus stop in the morning should be quivering in terror—not of the thing that threatens their children the most, auto accidents, but of something that threatens them less than lightning strikes, ISIS.

Ben Carson used part of his opening statement for a “moment of silence” for the San Bernardino victims.

§

The main event began in much the same way as the JV event before it: a Trumpfest. The first question, of course, was to Mr. Trump, asking about his plan to ban Muslims from entering the country. His answer is worth reading in its entirety:

“We are not talking about isolation. We're talking about security. We're not talking about religion. We're talking about security. Our country is out of control. People are pouring across the southern border. I will build a wall. It will be a great wall. People will not come in unless they come in legally. Drugs will not come through that wall. As far as other people into migration where they're going, tens of thousands of people having cell phones with ISIS flags on them. I don't think so, Wolf. They're not coming to this country. And if I'm president and if Obama has brought some to this country, they are leaving. They're going. They're gone.”

Then Jeb Bush was asked about the Trump Plan. “He’s a chaos candidate,” Mr. Bush said, “and he’ll be a chaos president.” CNN showed him in split-screen with Mr. Trump almost the entire time.

Then Marco Rubio, then Ted Cruz. We get a debate, back and forth, about whether or not banning Muslims from the country is a good idea. Candidates only got a minute and fifteen seconds to answer questions, but Donald Trump got himself the first twenty minutes of this debate taking seriously his plan. Total victory: Trump.

§

This debate was about fearmongering. It had only one topic: OMG WE’RE ALL GONNA DIE! With a budget deal apparently reached on Capitol Hill, and with the Fed poised to raise interest rates, the big topic: FEAR FOR YOUR LIVES!

Americans are more afraid today than at any time since 9/11, one of the moderators pointed out. (Not over, you know, the 11,000 Americans killed every year by gun violence; but over the fourteen killed by ISIS-inspired terrorists in San Bernardino.) We’re at war! The very survival of our country is at stake! Everywhere in America, Chris Christie said, is a target for these terrorists.

Earlier today, some kids in both Los Angeles and New York City figured out a clever way to get out of a day of school. Los Angeles fell for it; New York didn’t. The Republican candidates went with Los Angeles. Your children are at risk! No, not from drowning in bathtubs, which claims 335 lives per year in this country, nearly 100 of them children; but from a bunch of wankers in an Asian desert.

We need to carpet-bomb ISIS into oblivion, Ted Cruz has said; he would make the sand glow. Does that mean slaughtering innocent civilians in Raqqa, the moderator asked? Of course not, he replied; we carpet-bomb where ISIS is, not a city. I don’t think he understands what “carpet-bombing” is.

Or maybe he does. Donald Trump has said that we need to kill not only the terrorists, but their families as well—and he defended that position, saying that while the terrorists may not care about their own lives, they do care about their families. Rand Paul pointed out that this would mean withdrawing from the Geneva Conventions, wondering if Donald Trump believes in the Constitution, but that didn’t seem to bother Mr. Trump. “So, they can kill us, but we can’t kill them?” he quipped.

Political correctness is killing people, Mr. Cruz said. Encryption is killing people, John Kasich said. Immigrants are killing people, basically everyone on the stage said. Obama’s lack of leadership is killing people, everyone also said. (The 88,000 Americans killed per year by alcohol were not mentioned.)

So we got a debate about which of the nine people on stage would kill ISIS more.

At one point, Wolf Blitzer dragged Kim Jong Un into it. He says he has a hydrogen bomb! OMG WE’RE ALL GONNA DIE! (Settle down, Wolf. Kim Jong Un does not have a hydrogen bomb.)

It was tiring. ISIS is coming to kill you! Vote for me or your children will die horribly! No, not the more than a hundred who died from the flu in the 2012-2013 season because parents won’t get them vaccinated; we’re talking about ISIS here, less of a threat to your kids than lightning strikes, remember.

Chris Christie wants to be perfectly clear that hell yes, he will shoot down Russian planes. Rand Paul, again, was the lone voice pointing out that this would end up in a war with Russia.

At one point, Donald Trump suggested that if we didn’t spend trillions of dollars on silly wars in Iraq and Afghanistan, we’d have that money to spend on schools, roads, bridges, and so forth back home. Carly Fiorina actually attacked him for that, saying he sounds like a Democrat. Screw the roads and bridges; war is what’s really important.

The 480,000 Americans killed each year by cigarette smoking went unmentioned. ISIS didn’t kill them, see.

§

Jeb Bush spent the evening attacking Donald Trump. The two got into several bickering matches, and CNN seemed to have the Trump/Bush split-screen on constant standby. We hardly saw Mr. Bush without seeing Mr. Trump in the other half of the screen. “You’re not gonna be able to insult your way to the presidency,” Mr. Bush said. “I’m at 42, you’re at 3,” Mr. Trump replied.

Ted Cruz, on the other hand, continued declining to attack Donald Trump. He’s happy to let the others, lower in the polls, get their hands dirty. He’s not going to risk alienating the Trumpeteers if he doesn’t have to.

§

The big news of tonight came when Donald Trump was asked if he was ready to commit to the Republican Party, to support the nominee and not run as a third party candidate—and he said that yes, he is. Tonight, both in the debate and in post-debate interviews, he was unequivocal in ruling out a third-party run. Of course, he’s Donald Trump, so he surely reserves the right to change his mind…

§

Tonight’s big winner: ISIS. They got five hours of many of the USA’s most prominent political leaders, in front of a huge television audience, portraying them as a formidable foe, capable of destroying the country and about to do so. ISIS is as strong as the United States, we were told by people important enough to be in contention for the presidency.

Tonight’s winner on the stage: Donald Trump. Most of the debate was about him, even when he wasn’t speaking. And he spoke a lot: the moderators asked him the most questions, and with his rebuttal opportunities he had far more opportunities to speak than anyone else.

At one point, he was asked which of the “nuclear triad” (ballistic missiles, air, submarines) should be a priority to modernize. He completely failed to understand the question, even after it was clarified. But no one will remember that. If you watched, admit it: you’d already forgotten about it.

Folks, we’re looking at a real possibility that Donald Trump gets the nomination.
Photo

Post has attachment
I got tired of the sorry excuse for mixins that JavaScript lives with, so I made a library that encourages real mixin inheritance.

You define a mixin as a subclass factory:

let MyMixin = (superclass) => class extends superclass { ... }

And use it in the extends clause of another class:

class MyClass extends mix(MySuperClass).with(MyMixin) { ... }

No objects are mutated in the process of mixing. Constructors, method overriding, and super() all work as they should.

https://www.npmjs.com/package/mixwith


Post has attachment
I released version 0.5 of polyserve yesterday.

If you use the command-line, there is now a -H option for specifying the hostname. The server also redirects / and /components/ to /components/{package_name}/ making it easier to navigate to default pages.

If you embed polyserve in another server via makeApp, this is a breaking change, as makeApp now takes a single options argument. startServer now returns a Promise, so you can do this:

polyserve.startServer({
  port: port,
}).then((server) => {
  // do something with server (add more routes?)
}).catch((e) => {
  process.exit(69);
});

0.5 also fixes an issue where bower.json was always read from the current working directory, making embedding in a server with a different working directory difficult.

https://www.npmjs.com/package/polyserve

Post has attachment

Dear lazyplus #javascript,

How would you setup a project that's written in ES2015 and uses Babel to compile it's source, plus depends on npm modules that are written in ES2015 and use Babel too?

I haven't yet found a really clean solution, which to me means that I would have a single compile step in my project that transitively resolves and compiles imports and outputs a build that can easily be loaded or bundled without additional configuration.

What I see in practice in ugly and confusing to me...

Option 1) seems to be to use the precompiled bundles from dependencies and move them into some destination and either 1a) load them with <script> tags, or 1b) load with RequireJS and friends with either a configuration, or by placing dependencies just right relative to each other.

Option 2) is to load and compile in one phase with SystemJS, but I don't see a way to give per-module options to Babel, and you still need a path configuration or to move files around. I've found SystemJS to be finicky, especially when using Babel plugins.

So am I missing some setup that makes the pain go away (besides Dart :) which I desperately wish I were using for this project)?

Post has attachment
Wait while more posts are being loaded