Unfortunately, as more and more program logic slowly wafts towards the front end - testing that code becomes a thing too.
There are a few ways around this:
QUnit - https://qunitjs.com/
This is the testing used by jQuery and their stuff and is browser-based - so that's useful if you want to make DOM assertions but less easy to run in a big testing CLI script unless you want to start setting it up with a headless browser.
Mocha - https://mochajs.org/
Very much based in the world of Node.js - however this plugin ( https://github.com/jhnns/rewire ) allows you to test function-based classes that don't use Node's module.export patterns. Because Mocha is node based it can be run in the command line and does a very helpful list of working and not working parts - easy to run in a big CLI script of tests.
Writing unit tests in PHP is great for stopping old things you did from breaking. Writing code that can be easily tested, however, can be a bit of a shitter. It depends on all the parts of your program not only working together to make the application, but also working without all the other parts around (at least, with it's most crucial dependencies mocked by the testing environment).
The most difficult code to test is code that constantly refers to global objects. The main offenders with these are database handlers or objects containing environment globals. Code that jumps out to these global objects and grabs data is difficult to test, so consider using Dependency Injection to pass the required objects into the class (or System Under Test, or SUT, in testing parlance) on instantiation.
The ever excellent PHP The Right Way has a brief explanation of Dependency Injection.
Also this series linked above is pretty much great and you should read this guy's whole blog and have a great time: https://jtreminio.com/2/programming13//programming3/unit-testing-tutorial-introduction-to-phpunit/
TypeScript is JS with extra type descriptors that only make trouble when compiling. Therefore allows slowly moving towards type safety.
Also has it's own versions of some ES6 bits, like classes, which work as you might expect in PHP etc.
As always, this site has some pretty great basics:
Most important - any valid in regular JS is valid typescript - it falls through, as such.
26 07 2017 08:07 | #1 /brokencapitalism
The FT this morning runs a piece about how the majority of high-end London homes coming off the market are being withdrawn rather than sold. This speaks volumes about people's perception of reality, reality itself and our reticence to accept that the value of our homes (or investment properties) is falling.
The prime central London market has been falling for months but still these presumably above-averagely educated and informed owners are still in denial - so what hope for the rest of the country to reach sanity?
The underlying question I want (as a younger, non-home owner) to ask here is when will prices normalise?
The causes of today's high prices are simple: 10 years of governmental intervention (QE and low interest rates in particular) have inflated the price of assets. Everyone who held them in 2008 have pretty much only had the option to buy each other's at increasingly expensive prices - all of them getting "richer" in this Ponzi-scheme kind of a way, but also in a real way since the value of non-assets - food, etc have stayed the same, pinned down by low wages. (This "differential inflation" has been huge in the unofficial world of assets, at the expense of low or zero inflation in the everyday items that make up the official inflation measure - mostly those things consumed by the young and relatively poor - exacerbating inequality)
What's propping it all up?
- Low Interest Rates (a) allowing mortgagees to stretch the amount they can borrow
- Low Interest Rates (b) making buy-to-let returns (initially) way better than savings accounts
- Help-to-buy and other ultimately unhelpful market interventions
- Bank of mum-and-dad, passing on equity gains to allow purchase of houses out-of-whack with wages
What's stalling it now? Over time the above factors max-out:
- Wages are not growing in any meaningful way, creating a limit to what any job (assuming a range between £25k and £150k for most everyone) can stretch to - properties over £600k simply cannot be purchased by income alone, regardless of job
- There comes a point at which rental returns come back into balance with less hassely savings products. A £1m house needs to charge £20k/yr rent just to make a 2% return (excluding costs). Rising prices further reduce yield until once again other options - even at low rates - become viable
- Ignoring the political sensitivities, prices eventually reach a level even help-to-buy can't boost past
- As mum and dad get old and their equity fails to inflate further, draining it becomes less of an option - particularly when expensive care costs start to hit (as they now are for the elder of the baby boomers)
- Homeowners with decent equity are running out of working age road - getting too old to secure a re-mortgage in order to substantially upgrade. The "remortgage wall"
- Younger homeowners who haven't benefitted from the same explosive price inflation as their parents don't have enough equity to move. The "rungless ladder wall"
- The even younger have given up on houses. Jobs - all of them - don't add up to houses, and they know it - so they are not even bothering
There are no magical ways to prevent these factors continuing to impact the market. The magic money tree might be shaken again, with QE boosting prices but it will also further crystalise the sales freeze. Helicopter money is out since that would also set off the inflation bomb. Property prices it transpires have a ceiling past which they cannot lift without a shift in the value of money itself. What's more, any upward change to interest rates or inflation once at the fully-inflated top will accelerate the destructive effect.
The only realistic way is down - the question is really how long can the market tread water? The answer to that is probably the same amount of time that the general public can continue to suspend belief. Or perhaps just a little bit shorter.
... is that they WANT less people to get their healthcare via government. So why aren't they pleased with the CBO analysis when it says that 33million fewer will be insured https://www.cbo.gov/publication/52939 ?
If they believed their ideologies were right, they would be able to just say - "We believe it's right that fewer people get healthcare through government because that way we can make government smaller and reduce taxes. The way to get healthcare is to pull yourself up by your bootstraps and get rich like us. If you're already sick and really poor, we'll still have a really basic Medicaid so we don't totally go against everything Jesus taught but if you get sick then basically you're ruined. But as soon as all the sick and poor people die out everyone will be happy like us!" /politics /ahca
This is for me. I find it hard to juggle lots of stuff simultaneously; my brain has limitations - probably more than other people's. I suffer from systemic disorganisation. My TextEdit consists of a flotilla of windows sandwiched between Chrome and my desktop; my Google Keep is uncontrollably rammed with inappropriately lengthy uncategorised stuff; and my inbox is a multi-thousand unread post-apocalypse world of missed opportunity.
In the public sphere my Tumblr is neglected - but not as badly as my Medium and blogger accounts. Sometimes I build blogs or bigger CMSes as part of the systems I attempt to steer into the world, but off the shelf ones are awful - to build, adapt or use.
In short - my life is a messy pile of squandered ideas and disconnected threads.
BigNote; LittleNote is my attempt to solve this (or at least help).
Get started by logging in and going to /me (everyone has their own) which is like that moleskine you religiously carry (or textedit or whatever). It's your private thoughts (stored locally in your browser) - the myriad little ideas you have go in the small column on the right; the more lengthy culmination of those thoughts on the left.
To publish, choose a user tag for the world can know you by. For example, mine are /jamesleeds and /brokencapitalism
Order is important - it's a pile (i.e. not chronological). This is so that the most recently accessed stuff always bubbles to the top, because I never get around to archiving the junk - the idea is that it just disappears into the bowels of your account over time. You can always search, and if you feel the need to categorise use a "/" - which neatly doubles as the url to get back to that pile of stuff. So /cars is the pile where I keep my largely embarrassing petrol (or increasingly electric) head fantasies - see /jamesleeds/cars or /me/cars for your private vehicular thoughts - with /cars standing for everyone's.
And that's pretty much it. You're welcome to use it. I love it, though I won't take offence if you don't.
UK Councils spend about £1bn/yr on temporary accommodation to keep homeless families off the streets:
The answer to this is politically simple: BUILD SOME SOCIAL HOUSING.
- It doesn't cost much (each family home c. £120k in actual bricks + labour)
- They've got plenty of land
- They control the planning permission
This will also help the capital poor younger generations (e.g. tax payers) because there are more houses and stops putting public money directly into the hands of (literally rent seeking) older asset wealthy classes.
We collect certain information or data about you when you use or visit bignotelittlenote.com. This includes:
- IP address and details of which web browser you are using
- Name, email address and other personal information which you will be aware of entering, and we will not disclose to third parties without your express permission
Where your data is stored
We store your data on secure servers provided by ISO 27001 registered data-centres in the UK.
It may also be stored outside of the UK, to be closer to international users. By submitting your personal data, you agree to this.
Keeping your data secure
Information transmitted over the internet is never regarded as completely secure, therefore any data you transmit is at your own risk.
That said, all communications with bignotelittlenote.com take place using an encrypted SSL (https) connection to ensure the maximum privacy / protection.
We have procedures and security features in place to try and keep your data secure once we receive it:
- We will not pass your personal information on to other websites or organisations for marketing or commercial purposes unless permission is expressly requested and given
- Anonymised data may however to used to statistical purposes
- All traffic - including payment transactions (if/when available) - are and will always be encrypted.
Disclosing your information
We will only pass on your personal information if we have a legal obligation to do so, or to enforce our terms & conditions or other agreements.
You can find out what information we hold about you at any point, and ask us not to use any of the information we collect.
Yes, we know it's the boring bit, but we've tried to keep these T&Cs as readable / short as possible - so please do read them.
By signing up to BigNoteLittleNote.com you agree to the following terms:
1. We reserve the right to suspend or remove your account with immediate effect for anything we regard as unsavoury, immoral, abusive, fraudulent or illegal in any way
2. Any notes posted are the views of the posting user and not BigNoteLittleNote.
3. Images / text must be owned by the posting user - or permission have be granted to that person. Anyone posting content written by others or images created by others without their express permission will have the offending posts removed.
4. Repeated violations of these content guidelines can lead to the removal of your account and/or banning of your email and IP.
16 07 2017 08:07 | #1 /jamesleeds
Understanding one's own (and other people's) ever-surprising ability to disregard what is blatantly true is something of an obsession for me ATM. When you believe something defines you ("I am a Christian") it appears this cannot be questioned without putting at risk the whole idea of who you are.
As it transpires, the same regions of the brain light-up under MRI when confronted with an actual knife-wielding physical threat as when a statement contradicts closely held beliefs important to our identity:
The thing I would question is the conclusion. Are "who we are" and "what we believe" different things?
There is no free market health care option; a true "free market" would allow poor people to die.
10 05 2017 06:05 | #1 /brokencapitalism
- freedom without prejudice (policing, judiciary, military)
- universal education
- healthcare - if you get sick they fix you
09 05 2017 06:05 | #1 /brokencapitalism
- Big business can borrow a ton more money for the same annual outlay (though I note from experience that small/medium businesses do not share in this bonanza)
- Governments spend less of their money on repayments (as indeed do other debtors)
- Monthly mortgage costs drop, the maximum amount people can borrow rises and house prices go up
Here s a big one. (well, quite small really.)
Hardly any decisions we make are based on a dispassionate assessment of facts or stats - we feel things. And I'm not just talking about those we consider less intelligent - the populists, the sheep - we are all readily persuadable as even smarter people don't make probability calculations in everyday life.
So what can we do if we don't wish to be part of the prejudiced throng - we can't stop our minds making simplifications ourselves? We can acknowledge WHERE we are making simplifications and honestly state so. There is nothing more terrifying than someone who makes a simplication on a sixpence as a means of coping but who then zealously defends it for fear they won't be able to cope if it might turn out to be wrong (or simply more complicated).
HSBC (who I have used for business for 1/hsbc years, and longer personally) have become more and more de-personalised over the last few years. I no longer even know if I have a bank manager, let alone what their name might be - and my businesses channel a not inconsequential amount of money through them annually (that sounded awful - sorry, I don't mean look at how much money we have - more give you understanding that we're not just talking about a few 1/hsbc,/hsbc/hsbc/hsbcs here).
They won't lend. Ever. Despite growing at a reasonable pace over the years, and having a fantastic credit history and strong invoices going forward they have NEVER wanted to help my wonderful, small / medium tech business. Anecdotally from friends, that is not reflective of us. They simply do not give a shit about small / medium businesses. Or tech. PERIOD.
17 01 2017 08:01 | #1 /jamesleeds
06 01 2017 07:01 | #1 /jamesleeds
In polling, 75% of Trump supporters want to repeal Obamacare even though they are mostly the poor beneficiaries. If you ask the exact same question without calling it "Obamacare" that drops to 13%http://www.salon.com/2016/12/21/drain-the-swamp-of-all-those-p-c-liberals-turns-out-trumpers-dont-care-about-lobbyists-or-plutocrats/
Those fighting against the USs fledgling ability to catch up with the rest of the civilised world and look after people who are ill are able to keep popular support against it by reminding people it was proposed by a black man.
In Kentucky, they even rebranded it so that those in need would take it up: http://www.vox.com/science-and-health/2016/12/13/13848794/kentucky-obamacare-trump
It's only after reading comments against various Obamacare articles that I understand (though disagree) with the opposition to it from poor white Americans. The rebranding of ACA as "Obamacare" is a racist issue THAT makes it sound like healthcare for poor black people, paid for by increased premiums to wealthy whites.
When he feels bad, /Trump accuses someone else of the exact sin. Adam Schiff gets it in the neck for being sleazy here: https://twitter.com/realDonaldTrump/status/8894734865/politics63854/politics9 when it's hard to imagine anyone less sleazy than the upstanding, measured Schiff whereas Trump has proved himself consistently awful to women in a creepy, sexual way. He accuses Hillary of illegality when under pressure himself for money laundering; calls out the NYT as "Failing" when he is the least popular president ever; and finally (and most perniciously for democracies) decries Fake News Media whilst repeatedly lying - quite possibly the biggest overall liar in terms of volume and impact in political history.
22 07 2017 10:07 | #1 /jamesleeds
... you can do anything, so you don't
- "Let me be clear..."
- "Believe me, ..."
- "This I can tell you..."
- "This I know..."
....that's akin to saying we might not face a military threat again; so let's not bother with an army /climate
Refreshing to see analysis that is both Pro-market and Pro-state: The Republican Health Care Crackup https://nyti.ms/2msnOz8
This week's Toca Town update allows you to claim free gifts when by typing 8 character words in the keyboard room. After some experimentation with my daughter, I thought we'd share the ones we've found (as nowhere else on the web seems to interested in children's games such as this)
...you can do anything, so you don't.
The unsolvable dichotomy of the right - they LOVE protectionism AND freedom of companies/individuals to do what they want
25 02 2017 22:02 | #1 /brokencapitalism
18 02 2017 20:02 | #1 /jamesleeds
18 02 2017 20:02 | #1 /jamesleeds
10 02 2017 15:02 | #1 /jamesleeds
06 02 2017 16:02 | #1 /jamesleeds
04 02 2017 14:02 | #1 /jamesleeds
The biggest split will be between those who draw a line and the power-sick—whose longing to have access to power, or influence
30 01 2017 21:01 | #1 /jamesleeds
30 01 2017 11:01 | #1 /jamesleeds
29 01 2017 19:01 | #1 /jamesleeds
29 01 2017 10:01 | #1 /jamesleeds
- Margin notes (always specific to you, but can be written against anyone's big thoughts!)
- "Following" people or piles?
- Different "levels" of friendship
- Collapse big thoughts into summary paragraph
Compare that to Obama in 2013:
20 01 2017 16:01 | #1 /jamesleeds
This is a 198/trumpinauguration Ford Mustang with a 4.2L V8 petrol engine that produces 119bhp. My older, 1974 1.6L makes more than that.
Yes, have been thinking about gamification for a while. Probably something for the free version
18 01 2017 07:01 | #1 /brokencapitalism
Would require a similar transition period to the move from OS9 to OSX, with MS universal binary equivalents.