|
Detect when Enter is pressed within an Input Element (Javascript)
-
snippets.bentasker.co.uk
-
6 years ago
-
eng
If a user presses enter on an input field in a HTML form, then by default the browser will seek out the first submit button within the parent form and then trigger that (essentially simulating the click). In today's Javascript heavy world though, it may be that your doesn't sit within a
|
|
My job involves a lot of staring at large numbers, mostly latencies in nanoseconds, and picking out magnitudes like microseconds. I noticed myself constantly counting digits in my text editor, in my terminal, and in Jupyter notebooks in my browser.
|
|
My job involves a lot of staring at large numbers, mostly latencies in nanoseconds, and picking out magnitudes like microseconds. I noticed myself constantly counting digits in my text editor, in my terminal, and in Jupyter notebooks in my browser.
|
|
Some (opinionated) guidelines for include file organisation in C/C++. Intro I present a list of points, probably best considered as guidelines, but which I'll refer to as rules throughout the rest of this post, since it trips off the tongue that bit more easily (or perhaps I just have some hidden authoritarian streak). I'll assume the reader knows something about writing code in C or C++, and understands at least the basics about how ....
|
|
Select contents of element and its children and copy to clipboard (Javascript)
-
snippets.bentasker.co.uk
-
6 years ago
-
eng
Sometimes it's helpful, particularly with a long element, to provide a button which automatically selects the entire content of a given element (including any children) and copies to clipboard This snippet provides a function for just that purpose Read more…
|
|
Select contents of element and its children and copy to clipboard (Javascript)
-
snippets.bentasker.co.uk
-
6 years ago
-
eng
Sometimes it's helpful, particularly with a long element, to provide a button which automatically selects the entire content of a given element (including any children) and copies to clipboard This snippet provides a function for just that purpose Read more…
|
|
Intercept Console Messages in Javascript (Javascript)
-
snippets.bentasker.co.uk
-
6 years ago
-
eng
Sometimes you want to intercept messages sent to console with console.log(), console.warn() etc. This might be so that you can use the messages in a JS originated error report form, or otherwise need to make the messages available to users without needing to explain about developer tools to them This short snippet will collect messages in an array window.logs so that you can then access the messages from other javascript functions Certa..
|
|
Intercept Console Messages in Javascript (Javascript)
-
snippets.bentasker.co.uk
-
6 years ago
-
eng
Sometimes you want to intercept messages sent to console with console.log(), console.warn() etc. This might be so that you can use the messages in a JS originated error report form, or otherwise need to make the messages available to users without needing to explain about developer tools to them This short snippet will collect messages in an array window.logs so that you can then access the messages from other javascript functions Certa..
|
|
The Chinese Layout Task Force works on the Requirements for Chinese Text Layout, and we have monthly calls to discuss issues and updates. One of the issues…
|
|
In order to troubleshoot a bug in the very early history of a project using git, I needed a way to show the git diff from “nothing” to the first commit. Since git keeps a linked graph of commits, what I wanted was a diff from the commit before the first one. Searching the onlines dug up this answer on StackOverflow , showing that there’s a specific commit hash we can use to diff from “nothing” to the first commit:
|
|
In order to troubleshoot a bug in the very early history of a project using git, I needed a way to show the git diff from “nothing” to the first commit. Since git keeps a linked graph of commits, what I wanted was a diff from the commit before the first one. Searching the onlines dug up this answer on StackOverflow , showing that there’s a specific commit hash we can use to diff from “nothing” to the first commit:
|
|
I went through a phase that involved reinstalling MacOS way, way too often. At a certain point I got fed up with installing things over and over again and decided to version my dotfiles. And so https://github.com/orf/dotfiles was born. This reolved around a bootstrap.sh script that clones your dotfi...
|
|
I went through a phase that involved reinstalling MacOS way, way too often. At a certain point I got fed up with installing things over and over again and decided to version my dotfiles. And so https://github.com/orf/dotfiles was born. This reolved around a bootstrap.sh script that clones your dotfi...
|
|
Developer? Need to know how to use Elasticsearch? Want to know how to get working with it quickly? This is the book for you! Buy now using Leanpub In elasticsearch mappings define type and values in documents. You use them to specify that fields within your document should be treated as numbers, dates, geo-locations and whatever other types elasticsearch supports. You can also define the stemming algorithm used and other useful index f..
|
|
After spending some time at work on tooling for keeping documentation in sync with Go struct definitions I had enough exposure to Go's built-in parsing package that next steps were clear: write an interpreter. It's a great way to get more comfortable with a language's AST. In this post we'll use the Go parser package to interpret the AST directly (as opposed to compiling to a bytecode VM) with enough to support a recursive implementatio....
|
|
Apple's new OSes are out. If you've looked through the documentation, you may have noticed that the prototype for objc_msgSend has changed . Previously, it was declared as a function that took id, SEL, and variadic arguments after that, and returned id. Now it's declared as a function that takes and returns void. Similar functions like objc_msgSendSuper also became void/void. Why the change? (Read More)
|
|
objc_msgSend's New Prototype objc_msgSend's New Prototype Apple's new OSes are out. If you've looked through the documentation, you may have noticed that the prototype for objc_msgSend has changed . Previously, it was declared as a function that took id, SEL, and variadic arguments after that, and returned id. Now it's declared as a function that takes and returns void. Similar functions like objc_msgSendSuper also became void/voi....
|
I have always liked painting but I had never devoted any time to this hobby. I was painting once every 2 or more years but with dissappointing results. Few days ago I tried to create a painting of my cat and I enjoyed both the process and the result. I decided to pursue this hobby and yesterday, I followed an episode of Bob Ross’ show “The joy of painting” (most if not all episodes are available on Youtube ). I surprised myself with th....
|
I have always liked painting but I had never devoted any time to this hobby. I was painting once every 2 or more years but with dissappointing results. Few days ago I tried to create a painting of my cat and I enjoyed both the process and the result. I decided to pursue this hobby and yesterday, I followed an episode of Bob Ross’ show “The joy of painting” (most if not all episodes are available on Youtube ). I surprised myself with th....
|
I have always liked painting but I had never devoted any time to this hobby. I was painting once every 2 or more years but with dissappointing results. Few days ago I tried to create a painting of my cat and I enjoyed both the process and the result. I decided to pursue this hobby and yesterday, I followed an episode of Bob Ross’ show “The joy of painting” (most if not all episodes are available on Youtube ). I surprised myself with th....
|
|
When we compare two distributions, it’s not always enough to detect a statistically significant difference between them. In many cases, we also want to evaluate the magnitude of this difference. Let’s look at the following image: On the left side, we can see a timeline plot with 2000 points (at the middle of this plot, the distribution was significantly changed). On the right side, you can see density plots for the left and ....
|
|
When we compare two distributions, it’s not always enough to detect a statistically significant difference between them. In many cases, we also want to evaluate the magnitude of this difference. Let’s look at the following image: On the left side, we can see a timeline plot with 2000 points (at the middle of this plot, the distribution was significantly changed). On the right side, you can see density plots for the left and ....
|
|
I often join Azure DevOps projects some time after they were started and can almost guarantee I'll find... questionable... permissions have been applied. If you search for e.g. "azure devops permissions" you'll get pages like this which only tell half the story, so here's a quick primer...
|
|
I’ve been trying to improve the web presence of my Toastmasters club - particularly the SEO-ness of the club’s webpage.
|
|
Offsites an invaluable tool in getting a team aligned. I’ve been a part of organizations where offsites never happened, and then when they happened at a regular interval. Just because offsites happened it didn’t mean they had the same significant impact to alignment and ability to execute moving forward. What follows is a few key principles around conducting an impactful offsite. Get out of the office An offsite isn’t reserving a co....
|
|
Offsites an invaluable tool in getting a team aligned. I’ve been a part of organizations where offsites never happened, and then when they happened at a regular interval. Just because offsites happened it didn’t mean they had the same significant impact to alignment and ability to execute moving forward. What follows is a few key principles around conducting an impactful offsite. Get out of the office An offsite isn’t reserving a co....
|
|
Snyk joins CloudBees new Technical Alliance Partner Program as Premier launch member
-
snyk.io
-
6 years ago
-
eng
We’re thrilled to join CloudBees’ new Technical Alliance Partner Program to take our collaboration with the CI/CD and application release orchestration (ARO) company to the next level.
|
|
Just occasionally, you'll ask someone for a packet capture, and rather than being sent a PCAP you'll get sent pasted output like this: < 2019 / 10 / 10 09 : 01 : 12 . 589497 length = 250 from = 0 to = 249 48 54 54 50 2f 31 2e 30 20 32 30 30 20 4f 4b 0d HTTP / 1 . 0 200 OK . 0a . 53 65 72 76 65 72 3a 20 67 75 6e 69 63 6f 72 6e ....
|
|
I challenged my twitter peeps: Challenge: you have a csv file and you need to import it into a new table in a database. You have 5 mins to get it done. What tools do you use? @secretgeek and was overwhelmed with the responses! So many different ways people approach the problem, and so many different tools. It reminds me of Miles' Law: Where you stand on an issue depends on where you sit. If you sit in python all day, y....
|
I challenged my twitter peeps: Challenge: you have a csv file and you need to import it into a new table in a database. You have 5 mins to get it done. What tools do you use? @secretgeek and was overwhelmed with the responses! So many different ways people approach the problem, and so many different tools. It reminds me of Miles' Law: Where you stand on an issue depends on where you sit. If you sit in python all day, y....
|
I challenged my twitter peeps: Challenge: you have a csv file and you need to import it into a new table in a database. You have 5 mins to get it done. What tools do you use? @secretgeek and was overwhelmed with the responses! So many different ways people approach the problem, and so many different tools. It reminds me of Miles' Law: Where you stand on an issue depends on where you sit. If you sit in python all day, y....
|
|
I like to plan ahead, and so I think about long-term financial security even now , in my early twenties. As the old saying goes, “The best time to plant a tree was 20 years ago. The second best time is now.” When I decide to retire, I will get to say I chose the first. Permalink.
|
|
Self-hosting your Google Fonts can save your customers around 3-400ms per page load. There's a Gatsby plugin that makes it super easy.
|
|
Emacs swiper is awesome. I bound swiper-isearch to C-s . Also a big fan of multiple cursors . I use it regularly (it's fun). I had totally missed Ole's post back in 2015: A simple multiple-cursors extension to swiper . Turns out, swiper has multiple cursors support out of the box (bound to C-7 by default). Yay! UPDATE: Thanks to irreal's post , please remember to add swiper-mc to mc/cmds-to-run-once list (or things won't w..
|
|
Developer? Need to know how to use Elasticsearch? Want to know how to get working with it quickly? This is the book for you! Buy now using Leanpub It is useful to understand is how elasticsearch stores documents. Documents that are indexed need to go into an index and have a type. Indexes can contain one or more types. This may sound limiting but you can search over all indexes or all types within an index or just one type within an in..
|
|
Series Index Why and What Projects, Dependencies and Gopls Minimal Version Selection Mirrors, Checksums and Athens Gopls Improvements Vendoring Introduction Modules provide an integrated solution for three key problems that have been a pain point for developers since Go’s initial release: Ability to work with Go code outside of the GOPATH workspace. Ability to version a dependency and identify the most compatible ..
|
|
I use Vim as a plain text editor for everything. Apart from coding, I write blog posts in vim, create quick notes and draft design documents. Surprisingly, I haven’t customized it a lot and am very lean about the plugins. While keeping my setup austerely simple, I rarely lack any of the functionality. However, recently I wondered if I can achieve a “distraction free” experience with Vim, like when you see a full screen text, nicely centered..
|
|
I use Vim as a plain text editor for everything. Apart from coding, I write blog posts in vim, create quick notes and draft design documents. Surprisingly, I haven’t customized it a lot and am very lean about the plugins. While keeping my setup austerely simple, I rarely lack any of the functionality. However, recently I wondered if I can achieve a “distraction free” experience with Vim, like when you see a full screen text, nicely centered..
|
|
A Snyk peek into Node.js and npm’s state of open source security report 2019
-
snyk.io
-
6 years ago
-
eng
In the State of Open Source Security Report 2019, we set out to measure the pulse of the open source security landscape throughout the different language ecosystems and have analyzed responses from over five hundred open source maintainers and users who provided us with insights into their processes and knowledge of open source security risks as well as the skill level of the average maintainer.
|
|
The folks over at Seeking Alpha , one of my new favorite websites, posted an interest writeup on a portfolio that has outperformed the market since October, 2014. Check out the original article here . As I work to eliminate debt and build a nest egg, so that I can then invest and prepare for retirement early , this subject has become ever-more interesting to me. Seeking Alpha — clearly — has some great advice, from some smart people. ..
|