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
This file contains 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 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 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
Lumos Labs Learning Team Bi-Weekly Ruby Snippet (11/21/2014)
One of the language features that really impressed me when I first started using Ruby was all the magic of Enumerable. No other language I know of lets you iterate so effectively over collections of objects. Let's say you wanted to sum together an array of integers in Java, for example:
int[] numbers = newint[5] { 5, 3, 8, 1, 2 };
intsum = 0;
for (inti = 0; i < numbers.length; i ++) {
sum += numbers[i];
}
Converts params that appear in a Rails log to HTTP GET/POST params
This file contains 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
Provides a way to perform Ruby `require` statements at the file (really the block) level
This file contains 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
Learning team bi-weekly code snippet for 5/13/2015
Three Useful Ruby Methods you Didn't Know Existed, and What to do With Them Now You've Wised Up
Yep, it's time for some cool Ruby trickery.
String#force_encoding
At their core, Ruby strings are just sequences of bytes. How you or your computer chooses interpret and display those bytes can mean the difference between legible text and complete garbage. Consider UTF-8 text for example. We now have great Unicode support in Ruby (as of 1.9) via the String#encode method and its friends, but again, strings are really just bytes.
Telling Ruby your string is encoded in UTF-8 tells it how to print your string on the screen or in your web app. For example, let's say you have a string that contains Japanese text (says 'arigato') "ありがと". Furthermore, let's pretend Ruby thinks the string is encoded in ASCII, which doesn't support Japanese characters. If you tried to print your string in the terminal, you might see something like this: "\xE3\x81\x82\xE3\x82\x8A\xE3\x81\x8C\xE3\x81\xA8". What you're seeing
Exporting base CLDR data using Sven Fuch's ruby-cldr gem
This file contains 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
Creating custom units.yml from Twitter Translation Center
This file contains 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 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