fabiochiu/medium-articles huggingface dataset:
Test Cricket, COVID and The Art Of Waiting
By: Aditya Raghavan
Tags: Australia, Cricket, Virat Kohli, India Vs Australia, Indian Cricket Team

Well, one of the things I have realised this pandemic has done is slowed down life in general. Our thought process. Our urgency to accomplish and the imagined state endless possibilities. Suddenly you are limited, you are constrained and more importantly your limitations are laid bare. This acceptance calms your mind and the break neck speed with which we have functioned all this while. You suddenly savor things more and you appreciate the value of patience. You cheer for every defence that Pujara played. Every leave that Kohli did. Every nudge that Rahane did. Suddenly you understand. Just like you understand your own vulnerability, you understand the batsman’s vulnerability at the crease. Life at stake. Wicket at stake. And the opponent is clearly stronger, cleverer and always a step ahead of you. So you don’t flay. You don’t bandy around your bravery. You wait. Not out of weakness, but knowing that your time will come. And you know that for every fall, there is a rise. You keep your head down and respect the situation. Because that’s what all you could and still doing. Wait patiently. And there is a lot of beauty in this. This acceptance of our own mortality and yet fight resiliently is what make human beings who they are.

Courtesy: Ryan Pierse | Not used for commercial purposes

And is there any other game that depicts this than test cricket? Test cricket allows you to fall. It allows you to rise. It teaches you that sometimes taking a back seat is the way forward. It teaches that sometimes attacking up front is the only way to go. It gives space to all characters, the genius, the defender, the fighter, the struggler, the counter attacker. It allows everyone to be who they are while thriving collectively. Just like life. All of this made possible by a sport. Are you joking? No am not.

Test Cricket will be the greatest sport played by humans ever. Long live test cricket!

Images: Ryan Pierse.

The write up is purely a passion piece and not used for non-commercial purposes
Attend IDP’s Australia Education Virtual Fair in your city
By: Anurag Sharma
Tags: Australia, Education, Study In Australia, Study Abroad, Students

Australia Virtual Education fair 2021

Thinking of studying in Australia? Work on your higher education plans in Australia from the safety comfort of your home. Attend IDP’s virtual Australia education fair and get a chance to meet face to face with representatives of top Australian universities and institutions online with IDP.

There’s nothing quite like living and studying in Australia and we at IDP, with over 50 years of experience in helping students study abroad, can guide you better in choosing right course and help you connect with the right Australian university that suits you and your study requirements.

Sign up to participate in our free online event happening across India from 15th Jan 2021 to 6th Feb 2021.

Event Highlights

· Interact over one- on- one video chat with international representatives & faculty from Australian Universities

· Discuss about programs, eligibility, scholarships and post study work opportunities

· Apply for 2021 intakes

· Know about the online to face to face transition learning options available for students

· Avail application fee waivers*, and much more

Find the list of participating Australian universities and city-wise fair schedule here: https://www.idp.com/india/australian-education-fair/

With over 40 universities participating in IDP’s biggest Australia virtual education fair, this is a great opportunity for you if you’ve planning to study in Australia in 2021. You can meet your preferred universities in person and discuss any queries you have in mind such as, covid19 updates, visa application process and more.

You can also avail free online pre-counselling with our international education experts and get answers to all your queries related to studying in Australia.
Freightmore Transport — Used Trailers For sale In Australia
By: Freightmore Transport
Tags: Trailers, Trucking, Australia, Freightmoretransport, Used Trailers For Sale

We are an Australian based semi-truck trailer manufacturing company. We sell and build all types of semi-trailers at affordable prices.

You are living in Australia and looking for the New And Used Trailer For Sale. Then we are the best choice for you.

Our trailers are custom built to your requirements, and we supply these trailers_

Drop Deck Trailer

Flat Tops

Tilt N Slide

Single Axle

Tandem Axle

Tri-Axle Trailers

And more, click here

Our Trailers Comes With The Following Features:

ATM Capacity- 11 Tonnes

(K-Hitch) Spring uderslung Suspension

LED Lights & Stabilizer Legs

Heavy-Duty Ramps

Full LED Lights

Water tank

“Visit Our Website To Know More_ https://www.freightmoretransport.com.au/
India vs Australia Test Matches played until Dec 2020.
By: Anupam Kumar
Tags: Data Visualization, Australia, Cricket, India, Data Science

Australia cricket captain Tim Paine (R) and India cricket captain Virat Kohli (L) pose with the Border Gavaskar trophy. Photo by PETER PARKS.(FreepressJournal)

The test contest between India and Australia is always a fan feast with many records and events. One of the most interesting series played by these nations which attained notoriety owing to poor umpiring decisions and poor sportsman from the hosting nation is Border-Gavaskar Trophy 2008. Earlier in 2001 Very Very Stylish Lakshman’s 281 against Australia at Eden Gardens which bagged the Greatest Indian Test Innings award in a survey conducted by Wisden Asia Cricket magazine still remains special to the cricket fans.

Let’s look at a few stats and plots of all the matches played before India and Australia take on each other for the 99th time in Test cricket on 17.Dec.2020. The long rivalry continues and now it’s time for us to visualize analyze using python libraries and Data Science.

Match Results Head to Head Aus vs Ind in 98 matches

Results of Matches contested Ind vs Aus

India’s overseas performance has been not so great and in Australia it is not an exception. Historically, India have won only 7 Tests in Australia, of which, 2 came in 2018–19 series (IND won 2–1 out of 4 Tests). Whereas Australia have won 29 of them, and drew 12 of them.

India’s performance in Australia

Senior players — Highest matches

Sachin Tendulkar is the senior most player who has played in most number of matches contested b/w Ind and Aus. He is followed by Ricky Ponting. Among the active players , Ishant sharma is the senior player.

Senior players in terms of matches

Generally if a player gets out with out scoring any runs is said to be duck out. For batsman it is an embarrassment ,however if we see the top players with duck outs in the encounters between Aus vs India ,batsmen have been saved from disconcertment. This is because the list of players with most ducks features mostly bowlers.

Players with most ducks

Scoring a double hundred in any format is a great achievement to a cricketer. Let’s see the players with highest score more than 200.

Highest Score by Players

Michael Clarke is the only player to score a triple hundred. The next highest score is 281 by VVS Laxman. The only wicket keeper batsman featuring in the list is MS Dhoni.

Master blaster Sachin Tendulkar has hit highest number of centuries among all the players who played in Aus vs India matches. Among the current players only Kohli and Steve Smith have hit 7 centuries each and Pujara scored 5 centuries.

Count of centuries hit by players in Ind vs Aus

It’s time to see the players who have hit at least 5 half centuries.

Count of 50s hit by players in Ind vs Aus

The list is again topped by Sachin. Among the active Indian players the list features KL Rhaul, Pujara,Rahane.

The analysis features mostly on batsmen ability of Indian and Australian cricket team. This work is done using python libraries pandas, matplotlib, seaborn etc. using jovian.ml platform .Hope you enjoy it.

References
Online shopping frenzy
Tags: Asx, Australia, Grafa, Money Mate, Newsletter

Friday Money Mate — 27 Nov 2020

Australian retailers are expecting that Black Friday sales will be Australia’s biggest yet.

Your inbox is probably clogged with Black Friday deals and couriers say parcel deliveries have spiked by up to 40%.

Retailer stocks including JB Hi-Fi and Harvey Norman all rose this week.

ASX

The ASX had the best monthly rise on record, despite finishing 0.5% down on Friday.

The index is riding high on the back of investor confidence as Australia’s COVID restrictions continue to ease.

-00.53%

Want to see more charts?

Preorder Grafa now!

ASX close to recovering 2020 losses

With the ASX skirting a 2020 recovery, retail stocks were higher this week as Australia’s COVID restrictions continued to ease.

Want to see more?

These media summaries are available in the Grafa App.

Click here to download.

Has Australia reached peak coffee?

Australia’s coffee consumption in the last 30 years still fascinates the media and modern-day historians who recount endless tales of post war migration, as the first espresso machines landed in European clubs across the country.

From a statistical perspective, spending in cafes and restaurants is now three times more than in department stores.

Know a mate who would like this? Forward it on.
Australia & China’s ‘Deteriorating Relationship’
Tags: Trade, Australia, China, Export, Trade War

After the U.S., and India, China’s relations are now deteriorating with Australia as the relationship between the two countries turns sour this year.

Escalating dispute

Australia is going to initiate the World Trade Organization (WTO) action for tariffs imposed on Australian barley by China, therefore, escalating the trade dispute. Australia’s trade minister Simon Birmingham described the decision as logical and appropriate next step to take for the country after urging Beijing to resume dialog to ease the worsening diplomatic dispute.

‘WTO dispute resolution processes are not perfect, and they take longer than would be ideal, but ultimately, it is the right avenue for Australia to take.’, he added.

The relations between the two countries soured earlier this year, and amid that China in May imposed anti-dumping and anti-subsidy duties totalling 80.5% on Australian barley. Not just barley, China had slapped up to 212% of taxes on Australian wine and launched a countervailing investigation into subsidized Australian wine imports. Beijing has been targeting Australian imports for products such as sugar, barley, beef, lobsters, and possibly coal.

China is Australia’s largest trading partner, for both exports and imports, therefore, the sectors targeted could take a hit until they find opportunities to sell majorly in other markets.

Political tensions

Tensions between the two countries have been intensifying this year, which wasn’t the case before. And now the issue seems to be more political in nature which is turning into a trade dispute.

Experts believe that it all started after Australia took certain stands regarding certain matters related to China that may have not been appreciated by Beijing. Australia had raised concerns about human rights in Xinjiang and Hong Kong. It had also banned Chinese firm Huawei from building the country’s 5G network. The country also backed the global enquiry into the origin of the Covid-19 that may have fuelled the tensions.

Soon after these political remarks by Australia, China started imposing trade sanctions on the country, citing contamination, pests, and shipment errors for the restrictions.

New actions

Trade minister Birmingham said they are highly confident that based on the evidence, data and analysis that they have put together already, Australia has an incredibly strong case. He also mentioned that there could be a possibility of further actions.

On another hand, news reports suggested that China is going to place new restrictions on Australian coal for which the Australian Prime Minister Scott Morrison has accused Beijing of breaching the International trade rules and their agreement.

Looks like the trade fight may escalate further with being nowhere near the end once WTO interferes, unless both parties are willing to sit down and work through the relevant issues.
Retail in focus ahead of “Black Friday” sales
Tags: Asx, Australia, Grafa, Money Mate, Newsletter

Monday Money Mate — 23 November 2020

Retail sales are in focus this week in Australia and the US as the biggest shopping day of the year prompts a flurry of promotions.

Amazon, Rebel Sport and JB Hi-Fi have all announced Black Friday promotions.

Keep an eye on the retail stocks this week.

23/11

Monday 9am EST Manufacturing PMI

Is Australia’s manufacturing sector recovering?

26/11

Thursday (US) Thanksgiving Day

Will the US take time off with their families?

27/11

Friday (US) Black Friday retail sales

Will retail stocks get a boost from Black Friday sales?

Will Black Friday make the market green?

Keep an eye on US retail stocks as well as Australian retailers with a presence in the US.

Black Friday retail sales have become one of the biggest events events on the retail calendar.

Want to see more?

These media summaries are available on the Grafa App. Preorder Grafa now.
For Nostalgia’s Sake, Let’s Talk About Australia
By: Jana Clarke
Tags: Life Lessons, Longing, Australia, Traveling, Travel

What is ‘your country’? No, I am not talking about your home country. I am talking about the country with a special place in your heart.

It’s the country you traveled to, and ever since then, you have not been able to get it out of your head. A place on earth that left you speechless. Somewhere every single part of your body wants to go to right now.

It might be the country next door (lucky you!), or a country far off. For example, ‘my country’ is literally located on the other side of the world.

Australia.

Even though it has been ten years since I have last set foot on its soil, I still feel the warm sea breeze on my skin. I still see the never-ending coastlines sinking on the horizon. I still smell eucalyptus forests everywhere. I still taste the best Shiraz in the world on my tongue.

Australia is with me every day, everywhere. Whether I want it or not.

Certainly, you as well catch yourself daydreaming about ‘your country’ every now and then. It can be painful, especially in times like these when traveling is everything but advisable. Right now, our places of longing tend to appear more inaccessible than ever. We feel like we have to put those memories aside, this unbearable wanderlust.

But shouldn’t we still allow ourselves to feel nostalgic about ‘our countries’? Of course! Let’s highlight the positive aspects of this nostalgia, though, instead of wallowing in self-pity and impatience. Let’s take a moment and be grateful for what ‘our countries’ have taught us.

In the following paragraphs, I want to share with you three reasons why Australia has been such a great teacher for me. Join me on my journey to the most beautiful spot of land.

That’s why I fell in love with Australia — and that’s why I’m rather happy than sad when thinking back to ‘my country’:
Ruby — Block. Block = {}, do ... end …
Tags: Ruby

Block = {}, do ... end , 最後一行的執行結果就是return值 , 在Block裡不能使用return, 不是參數

無法單獨存在必須要依附在別的code上，且是不會被主動執行的程式碼

{ puts "我是大括號" }

這段code是語法錯誤

—

def say_hello puts "妳好" end say_hello{ puts "我很好" } puts "太棒了"

執行路徑：

呼叫say_hello方法 -> 到def的say_hello -> 執行裡面的 puts "妳好" -> 回到呼叫say_hello -> 執行puts "太棒了" 中間並不會執行我很好

如果想要讓中間大括號裡面的 puts "我很好" 也被執行的話，需要使用 yield

def say_hello puts "哈囉妳好"

yield

puts "大家好" end say_hello { puts "太棒了" } puts "不錯喔" 執行路徑：

呼叫say_hello方法 -> 到def的say_hello -> 執行裡面的 puts "哈囉你好" -> yield(控制權讓回來) -> 回到呼叫say_hello並執行裡面的block -> 把控制權還給yield -> 執行puts "大家好" -> 回到呼叫say_hello -> 執行puts "不錯喔"

yield = 把控制權轉讓給block

yield也可以同時把參數帶進去

def say_hello yield 3, 8 end say_hello do |n, m| puts n

puts m end 執行路徑：呼叫say_hello方法 -> 執行say_hello方法 -> yield讓出去給say_hello方法並且把3和8一起帶過去 -> 3帶進n, 8帶進m 並印出來 -> 回到yield -> 抵達呼叫say_hello方法 若是yield沒帶引數，但是block裡卻有參數要接yield預計要給的引數的話，會印出nil 相反的，若是yield有帶兩個引數3, 8 ，但是block裡面只有一個參數的話只會印出3

※在Ruby裡面，如果要呼叫一個方法時，所帶的引數必須和action的參數數量一致。

例外

def xyz (a=0 , b=1 , c=2) p a, b, c end xyz 此時因為有給預設值，所以不會壞

def xyz(a: , b: , c:) p a, b, c end xyz( c:3, a:100, b:50 ) 此時因為有給key因此可以不照順序

在Block裡不能使用return

def hello p yield end hello { return 2 } 執行路徑：呼叫hello方法 -> hello action -> 印出yield -> yield把控制權給hello的block -> return 給呼叫hello方法 -> 就不會還給yield且往下繼續...

yield時，並沒有Block的話會噴錯(但有防錯機制)

def a if block_given?

yield

end end a

a{puts "我拿得到"} 執行路徑：呼叫a方法 -> 執行a action -> block_given? 判斷是否有block，如果是turn，yield就會讓出去，如果沒有就不動

土炮select

a = [1, 2, 3, 4, 5] def my_select(list) result = [] list.each do |n| if yield(n) result << n end result end p my_select(a) { |x| x.odd? }

如果這時候沒有寫result(當作回傳值)，最後的回傳值就會是 do ... end 這個block，

也就是回傳 list.each do { |x| result << x if yield(x) }，each 方法的回傳值就是list

{} 和 do…end 的差別

list = [1, 2, 3, 4, 5] p list.map { |item| item*2 }

p list.map do |item| item*2 end 因為{}的優先順序比較高，所以先執行 p 後面的那些東西，但是do...end的執行率比較低所以會先執行 p list.map 因此上面會印出 [2, 4, 6, 8, 10]

下面會印出 <Enumerator: [1, 2, 3, 4, 5]:map >

雖然Block無法單獨存活，但被 物件化 後就可以了

以下是Proc

add_two = Proc.new { |n| n + 2 } p add_two.call(2)

p add_two.(2)

p add_two[2]

p add_two.yield(2)

p add_two.===(2) 此處會印出4 利用Proc把Block物件話，也就是說這個add_two是一個物件，是一個物件化的Block

以下是Lambda(基本上與Proc.new相同)

add_two = lambda { |n| n + 2 }

add_two = -> (n) { n + 2 }

統整

add_a = Proc.new { |n| n + 2 }

add_b = lambda { |n| n + 2 }

add_c = -> (n) { n + 2 }

add_d = proc { |n| n + 2 }

Proc與Lambda的差異在於引數參數數量不一致時
Making a GIF background for your landing page in Rails
By: Daniel Yankiver
Tags: GIF, HTML, Rails, CSS, Ruby

As a visual person learning Rails I wanted to make my landing pages more dynamic. This is the first thing visitors will see and it’s a great way to capture their attention.

I spent a lot of time trying to use a short video that looped as the background for my landing page, but I learned that this can be problematic and quite complicated without JavaScript. As it turns out, using a GIF is much easier.

For the example below I chose a GIF from an animation because it seemed higher resolution, but you can use any GIF you want.

Original GIF created by @ramonmosermontes

In a few short steps I will show you how to make your very own dynamic landing page background!

Step 1: Create a Rails application

I called my new rails project future based on the GIF I used. You can call yours whatever you’d like.

rails new future

Next, I created a static controller named pages with an action called landing .

rails g controller pages landing

Then, I added a landing route to connect the root page to the controller and the action.

# config/routes.rb root to: "pages#landing"

Step 2. Find a GIF

Honestly, this might be the longest step if you’re particular like me. A lot of GIFS are low resolution and may look pixelated on your landing page like the one below:

Original GIF created by Besan777

It’s still captivating, but I suggest googling high resolution GIFs and finding one you like. You can also look on one of the many GIF websites like Giphy, Gfycat, Tenor, GIFbin, or IMGflip. You can even try your hand at making your own GIF using websites like GIF maker or any of the infinite amount of GIF creating sites and apps out there.

Once you find a GIF you like, download the .gif file.

Step 3: Add the GIF to your assets pipeline

Next you need to go to app/assets/images and add the GIF you downloaded there. You can do this however you’d like. I just dragged and dropped my GIF from my downloads folder on my computer into the /images folder in VSCode.

If you are using VSCode you should see the GIF live and moving after you drop it into the /images folder.

Step 4: Adding the necessary HTML

I am sure there are many other ways to do this, but this is how I did it:

#app/views/pages/landing.html.erb <div class="gif-wrapper">

<h1 class="landing-title"> FUTURE </h1>

</div>

I made sure to add a "gif-wrapper" class and a "landing-title" class so I could style the GIF and title in CSS.

Step 5: Adding the styling in CSS

This part is completely customizable. You will need to play around with it to figure out what styling is best for you and your project. I did it in such a way where the GIF is full screen and fits the size of the page. I also placed the landing-title “FUTURE” on the bottom because that’s where it made the most visual sense for my GIF. You may want to place it in the center.
Easy step by step guide to running your first RSpec test
By: Sarvar Khalimov
Tags: Ruby, Rspec

RSpec test demonstration (how to use RSpec).

In this example, we will create and run RSpec test from the scratch. Please follow those steps in given order:

Create the directory where you want to test your Ruby code. Let’s call this directory testing_ruby (you can use mkdir) Navigate into this directory (cd) Initiated your RSpec by running rspec — init

As the result, you shall see two generated files: .rspec and spec/spec_helper.rb

Now, let’s add our test. In this sample, we assume we want to test the methods of Calculator, particularly the multiplication method.

4. Navigate to the spec/ folder (where all your tests will be).

5. Create calculator_spec.rb within the spec/ folder

6. Add the following code inside calculator_spec.rb:

#code require ‘./lib/calculator’ describe Calculator do describe “#add” do it “returns the sum of two numbers” do calculator = Calculator.new expect(calculator.multiply(4, 3)).to eql(12) end end end

We will talk about require ‘./lib/calculator’ in the next section.

For now, let’s quickly review RSpec keywords, describe defines a collection of tests. it defines an individual test example with a string argument. Without further explanation, it is clear that the expect clause is being used to test the multiply method of our calculator object with arguments 4, 3 and eql(12) clause with argument 12 setting what we expect indeed.

The only thing that is missing to test our Ruby code is our Ruby code itself. So, let’s add one: multiply method.

7. Create /lib folder from your project root.

8. Navigate to the folder (cd)

9. Create calculator.rb

10. Add the following code inside calculator.rb:

#code class Calculator def multiply(a,b) a * b end end

11.Finally, run rspec to test your Ruby code.
TTY::Prompt in a CLI Application
By: Irvin Natt
Tags: Tty Prompt, Rubygems, Software Engineering, Cli App, Ruby

A Command Line Interface Application, also known as a CLI application, is an interactive program that allows the user to navigate and process commands through their terminal.

During project week at Flatiron School, we were tasked with creating a CLI app that would utilize CRUD elements (Create, Read, Update, Delete) and would need to display some kind of output to our terminal. After brainstorming for a hot minute, we stumbled upon this neat, little Ruby gem called TTY::Prompt.

TTY::Prompt, created by Piotr Murach, is an amazing gem that allows users to respond to commands, or prompts, within the terminal. Users can insert inputs into the terminal and directly respond to prompts that have been programmed into the CLI app. It’s an interesting and easy-to-use gem that allows for a ton of interactivity with the user.

After doing a bit of research on TTY::Prompt usage, we discovered that one of the popular uses of the gem is to actually make a text-based adventure game. To put it simply, users are given a list of choices, and after selecting an option, they are then given another set of prompts, ultimately having some sort of end with a specific selection.
[Rails]使用acts-as-taggable-on, ransack, select2 實作 Tag 新增與搜尋功能
By: Besque Liu
Tags: Ruby, Rails

mbleigh/acts-as-taggable-on

Table of Contents generated with DocToc This plugin was originally based on Acts as Taggable on Steroids by Jonathan…
The Starting Four of Ruby’s Enumerable Methods: .each, .map, .select and .find
By: Mary Ann Navarrete
Tags: Iteration, Methods, Programming, Ruby, Coding

I started as a full-time student at Flatiron School’s Software Engineering Bootcamp five weeks ago. My biggest struggle those first three weeks was iterating through arrays and hashes to get the desired result or value. Trying to figure out which method to use just wasn’t clicking for me. I would end up using .each until I exhausted its possibilities, then go down the list of other methods until I got one to work. I failed my first code challenge because I couldn’t get past why I wasn’t getting the right result on one question when I knew the other ones on the test. That evening, I redid my code challenge on my own and got everything working perfectly. It was just a matter of timing.

Then in the 3rd week, we had our first partner project. My partner and I decided to go the data analytics route, analyzing the statistics of NBA teams and players. I mean, for someone who claims to love NBA data, not knowing which methods to use for iterating such data instantly was tough. My excitement to do this project soon became anxiety-ridden, as I felt my lack of quick decisiveness held me back. I had this sense of guilt that I couldn’t complete problems fast enough to balance out the workload between me and my partner. But I also was being way too tough on myself…(more on that in another post). Shout out to my partner Andres, for his patience and ability to sense that I was not enjoying this struggle with algorithms and methods. Throughout the week, he walked me through problems, asking me questions and allowing me to solve it even though he knew how to get the answer.

Which does WHAT?!? 🤔😩

One sleepless night at 2 am that project week, I was in bed googling about Ruby methods from my phone in the dark. After reading a few articles, I stumbled across someone’s medium post that explained the comparison, which finally made it click for me. They used the show “How to Get Away with Murder” as a way to explain these Ruby iterators, and it came with code snippets and memes! I also loved HTGAWM, and miss that show. (Credit to this person and thankful for their post! 👉🏻 check out it here!) I’m a visual learner, and just reading new material won’t always do the trick, especially trying to ingrain logic. I needed visuals and real-life scenarios.
Ruby variables and their scope
By: Sarvar Khalimov
Tags: Ruby, Ruby Variables

How to name Ruby variables?

As per Ruby convention, the variable name in Ruby starts with lower case letters using snake case style. If it starts with a capital letter, then it is constant. For variables that contain multiple words, underscore can be used. For instance: “my variable” can be named as my_variable. Numbers can also be used, however not as the first character.

To make the code more legible, it is always recommended to name variables as meaningful and descriptive.
Code Golf: Pros and Cons
By: Jacob On Software
Tags: Programming, Ruby, Code Golf

WARNING: Code Golf is For Fun

While it may seem obvious, programmers should not write all of their code as though they’re in a code golf challenge, and it’s not likely to advance your professional career beyond bragging rights. Imagine walking into a code review with your boss, eager to show them the innovative way you’ve printed “Hello, World!” to the screen in this nifty little language called Brainf***. It only takes up 72 bytes of memory! It’s amazing! Then, you pull this up on your screen:

--<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+.

A million things are probably racing through your manager’s head at this moment. Maybe they’re asking themselves what all this code is supposed to mean, or how they’re possibly going to maintain code like this if you ever leave the team, or why they hired you. More than anything, they’re probably thinking this:

Knowing the shortest or least memory-intensive ways to write code won’t do us much good in an interview or on the job. As programmers, our primary job is not to write the shortest solutions to a given problem, but to write clean, readable code. As Jon Bentley writes in Programming Pearls, “elegant code is the result of careful analysis of the problem, and finding an algorithm and design which simplifies the code greatly.” In following sound design principles, programmers have built incredible inventions and revolutionized the world. So while code golf may be a fun party trick and a way to win free internet points amongst your friends, it’s probably not your best bet for your day-to-day work.

Still, code golf can be a fun exercise, and it will undoubtedly make you a better programmer overall. Learning to test yourself in new and interesting ways is a big part of what makes programming interesting, and code golf offers an experience like almost nothing else. Luckily, there are a number of options today for people interested in challenging themselves with code golf. Thousands of developers post problems and solutions on communities like StackExchange and reddit, coding competitions increasingly add code golf challenges to their slate of contests, and some companies even host fun tournaments for employees. Hopefully this inspires you to get out there and start golfing!
Languages as Libraries
Tags: Programming Languages, Programming, Ruby, JavaScript

Few light weight languages has support for it’s runtime (virtual machine) to be wrapped as library. This make them embeddable in other language environments.

In the context of iOS/Android, we look at three light weight scripting languages & their runtime which are easy to embed in other languages,

Javascript

Lua

mruby

Javascript: When comes to Javascript embedding for iOS and Android, we have following options,

Lua: Many game engines embed lua for scripting support. There are plenty of examples exist on how to integrate Lua with C/C+.

mruby: Alternative to lua with ruby sysntax. mruby is designed for embedding and using in memory constrained devices.

Call flow between host and embedded languages:

Validating function parameters in the host language before being passed to embedded languages

Bridging type information of the function parameters being passed from host to embeded language.

Calling the function in embedded language with correct parameter type, value and order.

Converting return value from embedded language to host language.

Handle exceptions rasied from embedded language

Integration Challenges:

Integration between host and embedded languages has following challenges,
Adding Codecov to a Ruby Project
By: Aj Markow
Tags: Simplecov, Rspec, Ruby, Test Driven Development, Codecov

Photo by Luca Bravo on Unsplash

I was having trouble figuring out how to add Codecov to a ruby gem I was developing and testing with Rspec. So I wanted to write this guide to help show how to add Simplecov and upload your results to Codecov.

Prerequisites

Codecov Account (Sign Up — Codecov)

Codecov Enabled for Your Repo

Once you have this grab your Codecov Repository Upload token at:

A project with Test Results you want to upload.

In your Gemfile:

gem 'simplecov-cobertura', require: false, group: :test gem 'codecov', require: false, group: 'test'

Require Statements in your Spec File:

require 'simplecov' SimpleCov.start require 'simplecov-cobertura' SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter require 'codecov' require 'file_to_test.rb'

How to Upload:

Run your test suite with the commands you normally would. Navigate to the root project directory in your terminal. Run the following code:

bash https://codecov.io/bash ) -t {your token here}

4. If everything went right you should see feedback about a successful upload in your terminal.

You can now view your data at https://codecov.io/. I also like adding a badge to the git repository from Shields.io: Quality metadata badges for open source projects. They have a few different options for Codecov Badges

That’s it!
MongoDB
Tags: Nosql Database, Mongodb, Ruby

We are looking for someone who knows how to use NoSQL databases. But what does that mean. Does it just mean that SQL isn't necessary? What it means is that the storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.

How do non-tabular relations help us? In the end, it comes done to efficiency. With tabular relations, every single entry has to have the same data. You have to add a new column every time you want to add information for just one entry. When this one column is added it increases the amount of space needed equal to the number of entries. This is extremely inefficient and causes a lot of unused space. Instead of forcing every entry to have the same parameter, they are allowed to be fluid. Only adding the information that is necessary.

For MongoDB, this is thought of as a document structure. Every document is one instance of an object that stores the information for that object. Take 2 online shoppers. One is just buying a product once and the other is a frequent shopper at this store. The person who is buying once might not need the shop to store all of their information so they don't give it. While the other shops so frequently that they want an easy experience every time. These two people will have very different information save by the store. As the owner, you don't want to force the one-time shopper to give them all the information that isn't useful.
Initialize V .New — Ruby. No this is not the next great running…
By: Christopher Breen
Tags: Object Oriented, Initialize, Ruby

No this is not the next great running title of a Batman V Superman movie. This is a brief overview of the .new and initialize method in ruby. What are .new and initialize, well the initialize method is and instance method and a part of the object-creation in ruby it allows you to set the initial values for an object. Where as the .new is a class method that creates an instance of the class.

Let’s say we have a Human Class, this human needs a name and and age how can we pass these values into the object ?

The .new method is how we create the new object in Ruby from our Human class. The two arguments we passed in ‘Chris” & 27 will result in an error if we don’t define our initialize method because our Human class does not call for any arguments to be defined.

With the initialize method defined we can pass those two arguments into our new Human and because we’re using instance variables ‘@name = name’ . Lastly defining initialize is not needed if your class doesn’t require arguments.
RubyRussia 2020: How the largest Ruby event went online
By: Evrone Evrone
Tags: Rails, Ruby, Development, Conference

For 10 years in a row, we have organized the annual RubyRussia conference in Moscow. Last year, we managed to bring together over 800 Ruby developers including Yukihiro Matsumoto, Aaron Patterson, Nick Suterrer, and other Ruby stars.

Even though many things have not gone according to plan in 2020, we managed to make the conference a success in an online format, getting more than 600 attendees during just the first day of the event!

Learn more about the challenges of transferring such a large event online, find tips for holding online events, and get links to the reports about complexity in Rails projects, design and development of an asynchronous architecture, and much more:
PurgeCSS Extractor for HAML. We’re using the Tailwind framework for…
By: Expected Behavior
Tags: Tailwind Css, Haml, Technology, Purgecss, Ruby

We’re using the Tailwind framework for the new DocRaptor marketing website. We’re also continuing to use HAML for our templating system.

The Tailwind library is an enormous 3MB so it uses PurgeCSS to remove unused CSS styles from your production CSS output.

Unfortunately, the default PurgeCSS extractors aren’t compatible with HAML markup. HAML looks like this:

%img.h-10.w-10.rounded-full{ :src => "...

PurgeCSS uses a regex to scan your files for words then compares those words to your CSS selectors. The default regex doesn’t consider periods or curly brackets to be word breaks, so PurgeCSS views img.h-10.w-10.rounded-full{ as one big word.

The fix is easy. In tailwind.config.js , update the default extractor regex to include brackets and periods as word breaks:

purge: {

content: [

'./app/**/*.haml',

'./app/**/*.js',

],

options: {

defaultExtractor: content => content.match(/[^<>"{\.'`\s]*[^<>"{\.'`\s:]/g) || [],

}

},
Vegan’s Restaurant Survival Guide, a Sinatra based web application
By: Erica Grundy
Tags: Programming, Ruby, Sinatra Project

Vegan’s Restaurant Survival Guide is a web application with features of Sinatra and ActiveRecord. It allows different users to create an account, sign in, also create with time created/updated, read, update, and delete a post (CRUD).

I enjoyed developing this application and increasing my knowledge of ActiveRecord. It seems a lot to learn at first, but with time everything starts making sense. After learning the fundamentals of associations, I now understand how complex it is to develop a web application.

I had fun building this project. Ruby has slowly started to make more sense, in general, and it was super helpful to watch how everything integrates in relation to websites. I am still a newbie in this programming territory, but the amount I have already learned just amazes and makes me want more.

I hope that Vegan’s Restaurant Survival Guide will evolve into a useful guide for those adventurers like me out there. Personally, I know I am gonna keep improving it and use it as my guide for eating out at non-vegan restaurants, and at the same time just focus on having a memorable time with people instead of spending time asking the waiter to find out if the soup has beef broth or not.
Episode 5: Coding for Sustainability and Equity with Arno & Floor
Tags: Code Of Conduct, Sustainable Fashion, Podcast, Ruby, Learn To Code

In this episode of Coding in the Wild, we interview Floor & Arno from the Netherlands! Floor Drees is a Developer Relations Manager at Microsoft, and Arno Fleming is a Tech Lead at The Next Closet, a sustainable marketplace for second hand designer fashion. Together they co-organize the Ruby Community in the Netherlands. Tune in as we discuss their love for the Ruby Community, English as a universal language for coders, and building inclusive communities in the programming world.

The Coding in the Wild podcast is also available on Spotify and YouTube!

Episode 5 Highlights

Free web development for beginners course by Microsoft mentioned by Floor.
Flatiron First mile blog
Tags: New School, Ruby, Flatiron School, Software Engineering

Hi, everyone this will be my first blog ever so

“Hello, World!”. Recently I decided to start my boot camp at the flatiron school and take a leap of faith and hope everything goes well. I know a lot of you are also considering a career change and I am 33 this year if not now when right?. I have heard a lot of people say that you don’t need to pay the crazy tuition flatiron has or hey there’s that coding camp for 300 dollars, and from all the YouTube videos I have seen some people might be able to self learn without paying any more. Sure that’s possible but you have to be able to hold yourself accountable and have the kind of mindset to keep yourself going. I for one cannot do that I need a promise which the school gives and a dead line to complete each task and hold me accountable if I don’t Meet those deadlines.

Anyways, back to me I decided to start my new career as a software engineer and with the pandemic going on, this can’t be a better time.

I always had interest in coding and the back end of things I was always curious and fascinated by how everything works. I am also sick and staying home and watching my two kids play punks and each other so this is my way of getting out of the house or to my closet to get away from them.

I’m a native New Yorker and being in New York my whole life, and being in my comfort zone, making a career change is really hard but what I like about flatiron the most is that they have this income deduction program which once I graduate if I don’t Find a job that makes decent amount of money or any job at all they have refund you! Terms apply lol. But it gave me a sense that their serious about this and this gave me the courage to move forward for the career change.

This is my first ever blog hopefully I’m not too wordy or grammarly correct is that even a word? Well hopefully I don’t Frr any hate mails over this but I am optimistic!!
Ruby陣列的尋找include? vs find
Tags: Ruby筆記, Ruby, Rails

Learn more. Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Make Medium yours. Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore
CLI Ruby Gem Project — The Process and Key Takeaways
By: Ciara, Cici
Tags: Ruby, API, Cli Project

Demo of my CLI project

Project Planning & Structure

In my initial brainstorming of what Ruby CLI gem I wanted to create, I looked to a couple of my interests outside of programming: learning languages and gaming. Initially, I wanted use the API from one of my most visited sites, WaniKani, a SRS (Spaced Repetition System) tool for learning over 2,000 Japanese Kanji and 6,000 vocabulary words. After going through the API, I decided against using the WaniKani API to build my project — it just didn’t seem very accessible to a broader audience and it would require the user to have a baseline understanding of how the Japanese language functions.

I settled on building a CLI tool around League of Legends (LoL), and to make it more accessible, I wanted to build it for newer players who didn’t know much about the game and its characters (champions). There are over 150 playable champions in LoL, all with different characteristics that cater to a wide variety of play styles. My program would allow a user to search through a list of all the champions and select a champion they’re interested in to get more information on that champion (class, difficulty to play, stats, etc.).

I chose two sources from which I would pull the data needed for the program:

Riot’s API — Data Dragon

The Wikipedia page for League of Legends

After deciding on my data sources, I spent a lot of time watching (and re-watching) the video lecture recordings on the project and reading through the documentation of different CLI Gem projects. Reading through other people’s code was extremely helpful in figuring out how I wanted to structure my own program.

What I wanted to provide with my CLI tool:

A brief overview of the game, League of Legends

Scraped data from a site (Wikipedia), as well as from an API

At least 3 levels of interactivity to get to the Champion-specific information: (first) a main menu that displays the initial options (Overview, Champion List, Exit), (second) when the Champion List option is selected it will bring the user to the enumerated list of Champions where the user can select the champion, (third) then get detailed information of that specific champion.

In an attempt to follow the Single Responsibility Principle (SRP), I created five files for five classes:
My first portfolio CLI project
Tags: Flatiron School, Cli, Programming, Ruby, Projects

After being enrolled in Flatiron’s software engineering bootcamp for a month, finally it’s time to build my very first portfolio project. The last time I worked on any CLI app was few years back in when one of our teacher gave us task of building any CLI app using Assembly language, that I built a simple currency calculator. It was a totally a procedural program, no Object Oriented concepts were used. So it was pretty simple to build.

But for this project we had to use Object Orientation design and concepts, it took me a while to come up with my own idea of what I’ll build.

What I built

I had two options to choose from, either scraping a website or using built in APIs. I wanted to build a tweet livestream of certain keywords using twitter’s API. But they declined my application for developers access for some reasons.

So I chose to scrape IGN’s top 100 video games of all time. I scraped list of all the video games, along with description, release year, and the facts. Scraping was easy enough to tackle.

Parsing HTML

Using Nokogiri library I parsed the whole HTML, and selected the main attribute of HTML which was article , using .css method. That tag alone gave me all the information of top 100 video games. I selected facts, description, release year, rank and title of every game.

game_articles = parsed_html.css("article") game_articles.map do |game| hash = { fact: game.css("ul.ul li.item-highlight").first.text.strip, description: game.css("div.item-body p").first.text.strip, released: game.css("span.item-label-value").first.text.strip, ranking: game.css("div.badge-number").first.text.strip, title: game.css("div.item-heading a").first.text.strip }

Storing data

After scraping the data I had to store it my Game class so I can use it to build my CLI project. I built a Game class and stored all of the data in array of class variable @@all . And saved it using save method.

class Game @@all = [] def initialize(hash) hash.each do |key, value| self.class.attr_accessor key self.send("#{key}=", value) end save end def save self.class.all << self end def self.all @@all end end

Building CLI app

Flow diagram using draw.io

Here’s the flow diagram of my CLI app. When user starts the app, it loads up for few seconds and then gets the data from the web. And then user is greeted with a greeting message.

Using VS Code

And then user is asked to see the list or to leave the program. If user presses enter, they will see the list of 20 games only.

Using VS Code

And then user is prompted with the input again to see more list of games or they can type any number of list to get the information of that game.

Using VS Code

When user types the number, it sees the title, rank, release year, description and the facts of that game. Users can also press enter to see the list again or type exit to leave.
My first CLI Application
By: Jocelyn Peters
Tags: Cli, Ruby, API

Today I tuned in my first CLI application I had ever made. I’m a student at Flatiron school and have been studying software engineering for about 3 months. Something that has been bugging me (pun intended) for a while is how the individual, test driven, lessons of programming seem to be only mildly difficult — however writing code from scratch is way harder! Why do I think I understand all of these separate ideas, but I can’t seem to make them all harmonize?

My goal was to create a simple CLI for The Office fans. I wanted list episodes and allow the user to type in a number and get back information about that episode. Seems simple right? Wrong, at least not for a newbie like me. I struggled for days just trying to get my API to fetch information. After watching and re-watching tutorials, posting questions to blogs and getting help from a friend I finally got it up and running.

As I mentioned, I’ve only been doing this for around 3 months, and as time goes on I’m starting to learn that I won’t pick this up immediately. It’s going to take time and lots of practice.