Prototyping reactive interfaces with an adapted JavaScript Observer pattern – Ben Frain

For the purpose of this post, consider prototyping a simple stock buying widget. The stock price will change randomly and based upon the current stock price and our minimum buy price (that the user will input) a ‘Buy Stock’ button will light up or not as the case may be. This is as simple as possible a demonstration as I could imagine but you’ll hopefully appreciate the principle. What this widget does will not be important so much as the way it is doing it.

Source: Prototyping reactive interfaces with an adapted JavaScript Observer pattern – Ben Frain

Get Tenant Id from SharePoint App | JavaScript

In rare cases, you may need to find id for Office 365 tenant or SharePoint app catalog tenant id. This solution is for you, who want to get tenant id or unique id for a SharePoint farm with in a SharePoint App using JavaScript.

This solution can only be used when host web has SharePoint App installed, reason for that is, in order to get tenant id, it uses the product id of the app. If SharePoint App is installed in the site, this solution can be used in the host web or in the app web.


Open GitHub HTML/JavaScript project in Visual Studio 2013

Early morning today, it came to my mind that I never used GitHub integration for Visual Studio in my life. With lots and lots of energy, I started to google about the topic. After going through few results I ended up with reading and trying out Rick Rainey’s blog, it is a really good blog post which summarise all the information needed to start and work with project on GitHub with Visual Studio.

But for me, I wanted to do a slightly different thing, I wanted to fork the jQuery project in GitHub and open it from Visual Studio. Really unlucky for me, this project didn’t have a Visual Studio solution file to open it. I had to create a new solution and the relevant projects which were needed. These are the steps I followed in order to accomplish this goal.

1. Fork JavaScript (in my case, jQuery) project from GitHub

2. Clone the project to the local machine, this will download project to given path. Copy the project path before click clone, this will help you in next step.
When you double-click on the project, you will notice that there aren’t any Visual Studio solutions for the project.

3. Goto File->New Project, search for “blank solution”. Paste path you copied in last step to the location and cut last folder name from it and paste it to solution name. In this way, it’ll add a solution file inside the cloned folder. Select “Add to source control” and create new solution.

4. Now you have a new solution without any content to work with. Now you can add either the whole GitHub project as one project to the solution or you can identify parts of it and create separate projects for those. Next I’m going to create multiple projects for separate sections of the project. Right click on the solution, Add->Existing Web Site. Select folder you consider as section of the project.
Now you have Visual Studio solution for GitHub JavaScript/HTML project.

Happy coding!! 🙂