I just read an article describing another real-time javascript library, next.js. I have enjoyed using socket.io for sometime now. It's easy to overlook competitors when you're happy with what you know, love and use. I'm curious as to what advantages next.js brings to the table and may be a point of study in the near future.
That being said, it's always fun learning something new.
https://codeburst.io/build-a-chat-app-with-sentiment-analysis-using-next-js-c43ebf3ea643
This leads me to wonder what other real-time libraries might be competitors to Socket.io and Next.js.
The Lowly Life of a Tech
Tuesday, June 26, 2018
Monday, June 25, 2018
Custom Properties (Singel pattern)
I'm always trying to find ways to make my code more maintainable. How many times have you come back to your code 2 months down the road only to ask yourself, "What's going on here?" Admittedly, I have a short term memory, so it's definitely a good idea to use techniques that create self-documenting code, re-use common patterns and make it easy to hop in and add features without necessitating a 4 hour audit of the code first.I recently read an article by Diego Haz that suggests that one favor creating more components versus simply passing in custom properties to determine how a component gets rendered.
Unless you're creating a well-documented open source library, resist that. Besides introducing the need of documentation, it's not scalable and will lead to unmaintainable code. Always try to create a new single element — such as AvatarRounded — which renders Avatar and modifies it, rather than adding a custom prop.Diego admits that custom properties are not evil, but should only be used after carefully considering their need.
Wednesday, September 28, 2016
Unblock images previously blocked on Firefox
Have you ever accidentally clicked "Block Image" while using Firefox and you didn't mean to? I'm not sure if this is a bug on Mac OS Firefox or a more broad issue, but the documented solutions don't seem to be working for me.
https://gist.github.com/dcvezzani/b8457b3045cc648cd9d0e560a893446e
- click on page info, media tab and make sure that "Block Images" is unchecked. It doesn't work for me.
- used the Firefox sqlite extension to browse through permissions.sqlite to try and find the blocked file and change its permissions; no luck there either. I even shut down Firefox, renamed permissions.sqlite, and started up Firefox which creates a new permissions.sqlite db. Still, the image was blocked.
- shut down Firefox
- navigate to your Firefox profile directory (e.g., '~/Library/Application Support/Firefox/Profiles/nge0hgfo.default')
- open './jetpack/image-blocker@erikvold.com/simple-storage/store.json' and remove the offending entries
- save file and close; start up Firefox again
https://gist.github.com/dcvezzani/b8457b3045cc648cd9d0e560a893446e
Wednesday, September 16, 2015
Forcing git diff to compare non-text files
While trying to figure out how to make Git treat my uncompressed Pdf documents as text (and not binary), I found the following resources:
http://stackoverflow.com/questions/13486027/how-can-i-treat-a-file-not-a-binary-git
http://stackoverflow.com/questions/14771414/git-force-file-encoding-on-commit
It appears there is a way to customize diff. I haven’t tried it myself yet, but plan to in the future.
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes
Here’s a tool that can be used to `git diff` MS Word files.
http://docx2txt.sourceforge.net/
http://stackoverflow.com/questions/13486027/how-can-i-treat-a-file-not-a-binary-git
http://stackoverflow.com/questions/14771414/git-force-file-encoding-on-commit
It appears there is a way to customize diff. I haven’t tried it myself yet, but plan to in the future.
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes
Here’s a tool that can be used to `git diff` MS Word files.
http://docx2txt.sourceforge.net/
Thursday, May 21, 2015
Change Mac Calendar all-day event reminder time to something other than 9am
Kudos for the many who have provided those undocumented or not-well-known features for the Mac Calendar. There are many.
Scenario: I'm working productively when suddenly every day I get a dump of 15 event notifications that end up blocking the view of what I'm working on. My colleagues work on EDT while I'm on PDT. By 9am, I'm already in the thick of my day. I would rather the all day events not interrupt me at that time. Five Awesome Tips And Tricks To Master OS X Calendar [Feature] provides some guidance on how to change that as the Calendar preferences are limited; they expect everyone wants to be notified at 9am.
As mentioned in the article, you can override the "trigger" time for all day events by editing
Scenario: I'm working productively when suddenly every day I get a dump of 15 event notifications that end up blocking the view of what I'm working on. My colleagues work on EDT while I'm on PDT. By 9am, I'm already in the thick of my day. I would rather the all day events not interrupt me at that time. Five Awesome Tips And Tricks To Master OS X Calendar [Feature] provides some guidance on how to change that as the Calendar preferences are limited; they expect everyone wants to be notified at 9am.
As mentioned in the article, you can override the "trigger" time for all day events by editing
# find all files under ~/Library/Calendars/
# whose path includes LocalDefaultAlarms
# whose name does not include EventTimed
# open in favorite editor
grep -rl TRIGGER ~/Library/Calendars/ | grep LocalDefaultAlarms | grep -v EventTimed | xargs mvim -p
Simply edit the configuration files to the desired trigger time specified. Hours can be negative or positive and represent the offset from midnight of the day of the all-day event. For me, instead of being reminded at 9am the day before, I would rather be reminded at 7am instead, which turns out to be 17 hours before midnight for the all-day events.
# if you vim
:%s/PT15H/PT17H/g
If you want to get fancy, you could come up with a bash script that uses sed so the files don't even need to be opened in a text editor.
Friday, March 13, 2015
Launching a shell script as an OSX application
Go through this helpful tutorial to get started on understanding how Mac's Automator can make life easier. Look for the section labeled, "Using Variables from your Workflow in AppleScript".
To tidy things up, close the terminal window when we're done.
E.g., I have a script that opens up a file in a text editor and then runs a Ruby script using that same file as input.
[~/scripts/create-reminders.rb]
Then export the workflow as an Application and place in your Applications directory so that you can pull it up with Spotlight.
Other references:
To tidy things up, close the terminal window when we're done.
E.g., I have a script that opens up a file in a text editor and then runs a Ruby script using that same file as input.
[~/scripts/create-reminders.rb]
#!/bin/bash
home='/Users/dvezzani/Documents/journal/02-feb-2015'
ruby ${home}/create-ics-reminders.rb > out-reminders.ics
open -a Reminders out-reminders.ics
[~/Library/Services/create-reminders.workflow]
on run {input, parameters}
tell application "Terminal"
activate
do script "sh /Users/dvezzani/scripts/create-reminders.sh; exit"
end tell
return input
end run
Then export the workflow as an Application and place in your Applications directory so that you can pull it up with Spotlight.
Other references:
Monday, February 23, 2015
Searching for text in files whose filenames have spaces
Thank you, StackOverflow!
I have been dealing with spaces in filenames and it's been a thorn in my side.
Finally, some relief:
find idmexchange/ -name "*.xml" | while read file
do
grep -l "XPRESS" "${file}"
done
The difference between word-based iteration and line-based iteration makes all the difference.
Subscribe to:
Posts (Atom)