Enjoy!
See the Pen Online Lodash Tester by Travis Tidwell (@travist) on CodePen.
]]>This stack has many benefits that caters itself to the new Web 3.0 movement where the Internet of Things is radically changing old paradigms on how web applications should be built. For example, the M.E.A.N stack requires a total separation between the Front end application and the Backend server via RESTful API’s. This provides the ability for multiple front end applications to be built on top of a single backend REST service.
When learning how to build a M.E.A.N web application, one thing that frustrated me was the lack of a complete walkthrough tutorials on how to build an app within this architecture. I was able to find plenty of documentation over the atomic pieces of M.E.A.N (such as plenty of documentation and videos over AngularJS), but it was really up to me to put all the pieces together to build an application. I created this presentation and video as a COMPLETE walkthrough on how to get your application started.
I hope you enjoy it.
In short, my challenge is for everyone to stop saying “Yeah, Drupal can do that!” and instead start saying “Yeah, Drupal SHOULD do that!” and mean it.
I hope you enjoy.
So, for all those parents out there, who would like a good car movie experience for both the kids and you, here’s a nerds walkthrough on how you can make it happen.
For this step, you will need to spend some money… but it is not much. I too was on a tight budget, so here is what I found that works out great.
A DVD Player that supports SD/USB Cards – The SD/USB is the most important part here. That is what is going to free us from using DVD’s (which I will get to later). Here is the one that my wife picked out, and what I used for this blog post. It has good reviews and is cheap so we went with it.
A USB Drive or SD Card – Next you will need to get a USB Drive or an SD Card to hold all of your movies. Here is what I recommend.
Kids Headphones – Since you may have more than one in the car, your kids will probably each need their own set of kids headphones. These will limit the output volume so that it doesn’t harm the ears of your kids.
This step, you will need to download a piece of software that will help you rip your DVD’s into media files. I am on a Mac, so the software that I used was called Handbrake. The best way to do this step is really to just follow some already fantastic tutorials on how to rip your DVD. Here is a really good one that seems to be complete. – http://www.macworld.com/article/1157590/how_to_rip_dvd_handbrake.html
Now that you have a video file of your DVD, you will still need to transcode that video into a format that your DVD player can understand. Some of the more expensive players, you don’t need to worry about this, but since I was on a budget, I had to convert the videos that I had into a lower resolution AVI format. To do this, you will need FFMPEG.
1
|
|
1
|
|
1
|
|
1
|
|
We are now ready to start transcoding! To transcode any of your vidoes, simply navigate to the directory that contains your video and then type the following command.
1
|
|
You will need to change your command to take the name of your video (For me that was Ratatouille.mp4), and then also provide the name of the video that will be converted (For me that was Ratatouille.avi. This bit of code actually takes the original video and then scales it to the size of the DVD player screen as well as converts it to a format that you video player understands.
Now, lets say that you already have a folder filled with videos that you wish to transcode. It may be painful to wait for each and every one of them to finish before doing the next one. You can solve this problem by writing a script that will iterate through all the videos within a folder and convert them and put them in an “encoded” folder. To do this, create a new script called encode.sh and then place it inside of the directory with your videos. The contents of this file will be as follows.
encode.sh
1 2 3 4 5 6 7 8 9 10 |
|
You will now need to make sure this file is executable by typing the following.
1
|
|
You can now execute this file by typing the following in terminal…
1
|
|
This will now create all of the videos and place them in an encoded folder.
You are now ready to copy all the encoded files directly onto your SD Card, and then put this inside of your DVD Player. You should be able to get about 30 DVD’s worth of videos onto a single card!!
Happy Traveling!!!
]]>One thing that many people do not realize is that within GIT you can easily pipe the log to another application and quite literally build your own reports from within the command line. One of the more powerful applications that you can utilize is AWK, which allows you to write some code that parses through a log to generate a report to your needs.
Here are a few that I created to give you an idea of what you can do with this technique.
Determine how productive your team has been using git history.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Determine all changes to a file provided a date range in GIT.
1 2 3 4 5 6 7 8 9 10 |
|
Determine the diff provided a Pivotal Tracker Story ID.
1 2 3 4 5 6 7 |
|
Determine all commits for a developer given a time range.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
I hope everyone finds this useful. Now use the comments to share your own GIT with AWK magic!
]]>So, what is it about iFrames that people have a sour opinion? Well, for one thing, they can be abused, and unfortunately people LOVE to abuse iframes. My rule of thumb is this… Do not use an iframe to encapsulate an iterface that changes context. What I mean by this is you should not use an iframe if the page you are iframing has the capability of navigating a person away from a single purpose (like iframing all of https://youtube.com vs. just iframing a single video in YouTube).
Another problem with iframes is that they are kind of hard to work with… As it turns out, trying to create an iframe that appears to your visitor as a single seamless interface is not an easy thing to do. For this reason, I decided to create a single library that does all of the hard work for you. It is called Seamless.js and I hope you like it.
Click on these links to check out Seamless.js:
http://www.travistidwell.com/seamless.js/index.html (Seamless.js Website) https://github.com/travist/seamless.js (Github Project Page)
]]>ssh-keygen
on Mac and Linux, however on Windows…
this tool is not easily accessible to the non-technical person.
It then occurred to me (and a head slapped followed), that I have fairly recently published a library for Javascript RSA encryption which includes private and public key generation for RSA encryption. Not only that, but this is all available online.
So, if anyone needs an online RSA key generator, look no further than http://travistidwell.com/jsencrypt/demo.
This directly maps to the Open Source GitHub repository found at https://github.com/travist/jsencrypt, so anyone can modify this website to make it better.
And here is an iframe of the RSA key generation tool.
]]>But what REALLY excites me about this presentation is the project I came up with that demonstrates the power of these three JavaScript technologies combined. What I basically created was a command line application that allows you to order a sandwich from Jimmy John’s website. This should strike a chord with many geeks out there, since there is a legendary XKCD comic which I basically made real with this project…
So, without further adieu, I give you MakeMeASandwich.js!
I provide some instructions on how to install and use this library on the project page…
Also, I purposefully left my favorite sandwich and work address in the config.json if anyone decides they would like to say thanks… ;)
Ping me in IRC @ #drupal-dallas (travist) before you do it though…
Enjoy!
]]>Here is the problem… Phantom.js is not compatible with Node.js. However, there is a project that does expose the Phantom.js browser within the Node.js environment. This project is called Node Phantom, which does a great job at bringing PhantomJS to NodeJS. But, there is still another issue where the API to this library is not easy to use like Zombie.js.
That is why I built a library which leverages the Node-Phantom library, but brings in the Zombie.js API for ease of use. This library is called Zombie Phantom and I hope you enjoy it.
Also, please read the project description to get an idea of the differences between this library and the Zombie API before using.
Here is an example of how to use this library.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Enjoy…
]]>In addition to Jekyll, this blog is built using a technology that sits on top of Jekyll called Octopress, which simply provides a framework for building technology blogs… or in other words, it is a blogging engine for Nerds. Amazing stuff and I hope this enables me to easily add my thoughts from the past and the future.
And then finally, I cannot forget Github Pages. I am in love with Github and when they introduced this capability, it just solidified my allegiance to this company. If you haven’t had a chance to see this technology, then I highly recommend checking it out.
]]>Here are the details about this project…
This node.js package provides an easy way to automate and test Drupal using the Zombie.js framework. It provides some helpers that make working with Drupal within Zombie.js easy and fun.
Install node.js by going to http://nodejs.org
On OS X install the OSX GCC installer. On Windows you’ll need Cygwin to get access to GCC, Python, etc. Read this for detailed instructions and troubleshooting.
Since this tool requires 0.8 of node.js or earlier, you will need to install the NVM. Go to https://github.com/creationix/nvm and follow the installation section.
You can now install this library using NPM.
nvm use 0.8
npm install drupalgo
The configuration for your automation and testing should be placed within a configuration file in *.json form. This file contains your configurations for your Drupal installation as well as other configurations that you would like to include in your automation and testing, such as content creation, etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
You can now include this library in your test application and then do stuff using the simple drupal.go command. Since this library uses Zombie.js for its core browser, you can pass along any Zombie.js command from it’s Zombie.js API to the drupal.go command like so…
1
|
|
This function returns a Promise to be used with the popular Async.js library making it very simple to build intuitive tests without falling into callback hell.
Here is an example of how simple it is to write some automation with this library…
Login, then create some nodes….
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
This library is super easy to extend and create your own Drupal processes. You can do so by simply attaching them to the Drupal object and then they can be utilized with drupal.go like other processes. Here is an example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Happy Automating….
]]>It all begins with the bite… Let’s say you need to automate something repetitive that you always do within the Drupal UI. Or, maybe you would like to write automated tests for Drupal, but do not want to mess with the nasty installation and runtime of Selenium IDE. Enter Zombie.js… a lightweight, insanely fast, headless browser for testing and automation within a single Node.js package. No browser required. You have just been bitten.
Installation is simple. Because it is a Node.js package, installation is as simple as installing node.js on your local computer (http://nodejs.org), and then run
npm install zombie
You have just been infected.
You realize that writing simple tests and automation tools is simple. You select elements on the page using tools you know such as jQuery Selectors (Sizzle). The API is easy and intuitive. You are now walking.
You now cannot get enough… You are automating every mundane taks that you do within the UI. You now have a powerful command line application at your fingertips and realize that you do not need to build custom Services endpoints or custom Drush commands to do what you want. You hunger for more… welcome to the hunting phase.
You are now a believer. Zombie.js is amazing and will make your life easier.
]]>Much of this recognition should be directed toward the fantastic work of Tom Wu of Standford. It was his work with the JSBN library that really opened peoples eyes to the effectiveness of JavaScript in the field of encryption. However, there was just minor drawback to his work… The only real way to utilize his library is to have a full understanding behind the equations of encryption, which comes at as a huge hurtle considering the industry has been spoiled with the ease of use of the OpenSSL library generation of standardized keys used in the encryption. In this system, there is really only two things to worry about… The Public Key and the Private Key, used for encryption and decryption respectively. But in order to use Tom Wu’s library, you must learn how to utilize eight different variables to the encryption equations! I recognized this as a perfect opportunity to create a simple wrapper library around his library that simply speaks in terms of the Public and Private keys everyone is familiar with. Of course I found other libraries out there that claim to do the same, but what I couldn’t find in these libraries was a simple wrapper around this library that basically uses Tom’s library practically untouched, but simply adds a wrapper to provide parsing of actual Private and Public key-pairs generated with OpenSSL. Enter JSEncrypt.
Go to https://github.com/travist/jsencrypt to download this library.
http://travistidwell.com/jsencrypt
This library should work hand-in-hand with openssl. With that said, here is how to use this library.
openssl genrsa -out rsa_1024_priv.pem 1024
cat rsa_1024_priv.pem
openssl rsa -pubout -in rsa_1024_priv.pem -out rsa_1024_pub.pem
cat rsa_1024_pub.pem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
Here is a demo… http://travistidwell.com/jsencrypt/demo/index.html
This library heavily utilizes the wonderful work of Tom Wu found at http://www-cs-students.stanford.edu/~tjw/jsbn.
This jsbn library was written using the raw variables to perform encryption. This is great for encryption, but most private keys use a Private Key in the PEM format seen below.
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDHikastc8+I81zCg/qWW8dMr8mqvXQ3qbPAmu0RjxoZVI47tvs
kYlFAXOf0sPrhO2nUuooJngnHV0639iTTEYG1vckNaW2R6U5QTdQ5Rq5u+uV3pMk
7w7Vs4n3urQ6jnqt2rTXbC1DNa/PFeAZatbf7ffBBy0IGO0zc128IshYcwIDAQAB
AoGBALTNl2JxTvq4SDW/3VH0fZkQXWH1MM10oeMbB2qO5beWb11FGaOO77nGKfWc
bYgfp5Ogrql4yhBvLAXnxH8bcqqwORtFhlyV68U1y4R+8WxDNh0aevxH8hRS/1X5
031DJm1JlU0E+vStiktN0tC3ebH5hE+1OxbIHSZ+WOWLYX7JAkEA5uigRgKp8ScG
auUijvdOLZIhHWq7y5Wz+nOHUuDw8P7wOTKU34QJAoWEe771p9Pf/GTA/kr0BQnP
QvWUDxGzJwJBAN05C6krwPeryFKrKtjOGJIniIoY72wRnoNcdEEs3HDRhf48YWFo
riRbZylzzzNFy/gmzT6XJQTfktGqq+FZD9UCQGIJaGrxHJgfmpDuAhMzGsUsYtTr
iRox0D1Iqa7dhE693t5aBG010OF6MLqdZA1CXrn5SRtuVVaCSLZEL/2J5UcCQQDA
d3MXucNnN4NPuS/L9HMYJWD7lPoosaORcgyK77bSSNgk+u9WSjbH1uYIAIPSffUZ
bti+jc1dUg5wb+aeZlgJAkEAurrpmpqj5vg087ZngKfFGR5rozDiTsK5DceTV97K
a3Y+Nzl+XWTxDBWk4YPh2ZlKv402hZEfWBYxUDn5ZkH/bw==
-----END RSA PRIVATE KEY-----
This library simply takes keys in the following format, and translates it to those variables needed to perform the encryptions used in Tom Wu’s library.
Here are some good resources to investigate further.
With this information, we can translate a private key format to the variables required with the jsbn library from Tom Wu by using the following mappings.
modulus => n
public exponent => e
private exponent => d
prime1 => p
prime2 => q
exponent1 => dmp1
exponent2 => dmq1
coefficient => coeff
Regardless, one of my major complaints with Flatiron.js was that it lacks in OAuth. Looking around the Node.js community, there is a clear winner when it comes to OAuth, which is Passport.js. But, there is a problem… Passport.js was built on top of the Express.js applicaton framework and not Flatiron.js. Although, Express.js libraries are Connect.js compatible, and Flatiron.js is also Connect.js compatible, this isn’t enough to provide a clean integration between Passport.js and Flatiron.js. So, to solve this issue, I created a library that takes care of the integration work for you. It is called Flatiron Passport, and I would love for you to check it out…
Here is the readme from this library…
This package allows Flatiron.js applications to easily use the Passport.js authentication framework.
There are only two things that are different between using this API and using the regular Passport API.
1.) Instead of calling…
1 2 3 4 5 6 |
|
You simply need to call…
1 2 3 4 5 |
|
2.) Now anywhere you would use the variable passport, you replace that with fipassport in your app, like so…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
You simply call this instead…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Please refer to the included example to get a better idea….
npm install flatiron-passport
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
Happy Authenticating…
]]>