code tips

Originally published on medium.com I don’t think there is a faster way to build a web app than firebase and ember. The awesomeness of Firebase’s real-time database, no server, no backend, instant deployment, hosting and user authentication makes it an incredibly productive choice. Ember’s conventions and best practices and incredibly productive CLI makes it an excellent choice for your front-end. Let’s see how fast we can get a working app together. Create a Firebase App Go to your firebase console and create a new app [caption id="" align="aligncenter" width="1600"] Firebase Console[/caption] Create a Firebase Database [caption id="" align="aligncenter" width="1680"] Create…

Read More

Browser debugging tools have come a long way in a short amount of time. Here are some of our favorites. Firefox Firebug http://getfirebug.com Firebug is the quintessential developer plugin for Firefox. It comes with several powerful sections: Console The console allows you to view requests made to the server. Each can be expanded to view the response/request headers, the raw response, and the parameters sent. View the output from javascript console commands, such as console.log and console.error, which support printing an object that can be clicked on and viewed in the DOM tab. An input console which allows for the…

Read More

There's many ways to do so. You can use the close event and pickup values passed through the .data() method on the dialog, you can use a variable in the window context, but these are all very lacking in structure, however --All jQuery UI elements allow you to pass any value you want in while constructing t [code]yourSelector.dialog({ width: 500, height: 500, title: "Sample", success: function(response) { console.log(response); } // <-- this is non-standard }); [/code] Inside of our dialog, we can now access this success call back by doing yourSelector.dialog("option", "success"); Lets give a real world example. This dialog…

Read More

jQuery UI's autocomplete widget provides no built in functionality to alter the search behavior, but has a static filter method that can be overridden instead, and as such, will be on an application wide basis. "Super search" is a generic term meaning orderless word search, as that "foo bar" and "bar foo" discover the same results. This code can go anytime after jQuery UI library is loaded. [code] $.extend($.ui.autocomplete, { filter: function(array, term) { if (term) { var regexes = $.Enumerable.From(RegExp.escape(term).split(" ")) .Select(function(t) { var regex = new RegExp([".*?", t, ".*?"].join("")); regex.compile(regex.source, "im"); return regex; }).ToArray(); return $.grep(array, function(value) {…

Read More

Nen is  a LINQ provider and as such uses delayed execution. Delayed execution means that whenever a query is written it's not actually performed until the result set is being accessed, which is often by enumeration. Consider the following: [code]var workOrdersQuery = DataContext.Current.Get<EventWorkOrder>() .Where(t => t.WONumber == 3); // No query has been performed yet! var workOrdersCount = workOrdersQuery.Count(); // This runs the query of SELECT COUNT(*)  FROM slx_EventWorkOrder .... var workOrdersList = workOrdersQuery.ToList(); // This runs a query joining in all related tables and selecting all columns foreach (var workOrder in workOrdersQuery) // This is also accessing an enumeration  of the data set! This performs the same query as ToList() Console.WriteLine(workOrder.Subject); [/code] As you see in the comments, 3 queries were performed across what is inevitably the same result set. Rather suboptimal. The best idea is to store an enumerated data set. This way the results are…

Read More

As a supplement to this article, http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/lets look at jQuery event handling by example. [code] Hello World bar [/code] Event bubbling to parent [code] $("body" ).click (function() { console.log("body" ); }) ; $("p.hello").click (); >> body;[/code] Original event target on bubbling [code] $("body" ).click (function(event) { console.log($ (event.target).text ()); }); ("p.hello" ).click (); >> Hello World[/code] 'this' on event bubbling [code] $("body" ).click (function() { console.log($ (this).attr ("class")) ; }); $ ("p.hello").click (function() { console. log($(this ).attr ("class")) ; }).click ();[/code] [code] >> hello >> i-am-the-body[/code] 'currentTarget' on event bubbling [code] $("body" ).click (function(event) { console.log($ (event.currentTarget).attr ("class")); });$( "p.hello").click…

Read More

America's Best Software Engineers, On-Demand, at an Affordable Price
Surge Forward With Us