You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Last week I attempted to use the CSS sprites
feature of
Compass for the second or third time. It's been a struggle each time, but the
power and potential is there, so I keep coming back. This time was a bit
different, though, because I finally decided to stop relying on the docs and
dive into the code.
Before I go into the nitty-gritty, let's take a step back and talk about why I
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a much simpler HTTP library called HTTParty. The standard library that comes with Ruby is quite verbose, you have to convert a string to a URL, specify URLs and ports and all sorts of longwinded stuff. This is much easier. There's both a command line interface, if you just want to test things out for the queue at the command line, for example, as well as a ruby library. I'll show both here. You can install it with gem install httparty.
Command-line usage:
httparty -H Accept:application/json "http://nine.eng.utah.edu/schools"# Accepts JSON, uses POST instead of GET, and does BASIC authentcation, which the queue requires# once you've logged in. I can show you that later.
httparty -H Accept:application/json -a post -u username:password "http://nine.eng.utah.edu/schools"
Perfect for complex "client-side" application, where the complexity is more in the way "components" of an app interacts with each other than in the way they sync and or interact with a backend.
Very clean separation of concerns
Uses concepts that kind of look likes the future of HTML/DOM (DOM templates, binding attributes…).
Cons
A bit complicated to grasp. A lot of new concepts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post explaining why objects often use less memory than arrays (in PHP)
Why objects (usually) use less memory than arrays in PHP
This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)
The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?
The key here is that objects usually have a predefined set of keys, whereas arrays don't:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters