Ice-hockey predictions today (2025-10-31)
Austria
ICE Hockey League
- 18:45 Bolzano vs Val Pusteria -Over 4.5 Goals: 70.30%Odd: Make Bet
- 18:15 EHC Black Wings vs Vienna Capitals -Over 4.5 Goals: 97.50%Odd: Make Bet
- 17:30 Ferencvaros vs Graz 99ers -Over 4.5 Goals: 73.80%Odd: Make Bet
- 18:15 Klagenfurter AC vs Innsbruck -Over 4.5 Goals: 90.20%Odd: Make Bet
- 18:15 Red Bull Salzburg vs Olimpija Ljubljana -Over 4.5 Goals: 87.80%Odd: Make Bet
Belarus
Extraleague
- 16:00 Brest vs Khimik-SKA Novopolotsk -Under 1.5 Goals in 1P: 75.80%Odd: Make Bet
- 16:00 Dinamo Molodechno vs Lida -Over 1.5 Goals in 1P: 61.60%Odd: Make Bet
- 17:10 Metallurg Zhlobin vs Slavutych -Under 5.5 Goals: 60.80%Odd: Make Bet
- 16:00 Vitebsk vs HK Baranavichy -Over 4.5 Goals: 65.50%Odd: Make Bet
Canada
OHL
- 23:00 Kitchener Rangers vs Sudbury Wolves -Over 4.5 Goals: 81.20%Odd: Make Bet
- 23:00 Niagara Icedogs vs Mississauga Steelheads -Over 4.5 Goals: 90.80%Odd: Make Bet
- 23:00 Ottawa 67s vs London Knights -Over 4.5 Goals: 83.80%Odd: Make Bet
QMJHL
- 23:00 Chicoutimi Sagueneens vs Drummondville Voltigeurs -Odd: Make Bet
- 23:30 Rimouski Oceanic vs Quebec Remparts -Over 4.5 Goals: 75.70%Odd: Make Bet
- 23:00 Rouyn Noranda vs Halifax Mooseheads -Over 1.5 Goals in 1P: 73.70%Odd: Make Bet
- 23:00 Victoriaville Tigres vs Blainville Boisbriand -Odd: Make Bet
Czech Republic
Extraliga
- 16:30 Ceske Budejovice vs Karlovy Vary -Under 5.5 Goals: 75.10%Odd: 1.57 Make Bet
- 17:00 Liberec vs Vitkovice -Under 5.5 Goals: 60.60%Odd: 1.70 Make Bet
- 16:30 Mlada Boleslav vs Litvinov -Under 5.5 Goals: 68.90%Odd: 1.42 Make Bet
- 17:00 Mountfield vs Trinec -Over 1.5 Goals in 1P: 68.00%Odd: Make Bet
- 17:00 Olomouc vs Sparta Praha -Over 4.5 Goals: 78.60%Odd: Make Bet
- 17:00 Pardubice vs Kladno -Under 5.5 Goals: 73.60%Odd: 1.70 Make Bet
- 16:30 Plzen vs Kometa Brno -Under 1.5 Goals in 1P: 74.40%Odd: Make Bet
Denmark
Metal Ligaen
- 18:00 Esbjerg vs Frederikshavn White Hawks -Over 4.5 Goals: 92.80%Odd: Make Bet
- 18:30 Herlev vs Aalborg Pirates -Over 5.5 Goals: 94.60%Odd: 1.83 Make Bet
- 18:30 Herning Blue Fox vs Sonderjyske Ishockey -Over 4.5 Goals: 98.90%Odd: Make Bet
- 18:30 Rungsted Cobras vs Odense Bulldogs -Over 5.5 Goals: 75.50%Odd: 1.67 Make Bet
Finland
Liiga
- 16:30 Assat vs KooKoo -Over 4.5 Goals: 87.00%Odd: Make Bet
- 16:30 JYP vs Karpat -Over 4.5 Goals: 86.20%Odd: Make Bet
- 16:30 Kiekko-Espoo vs Jukurit -Under 1.5 Goals in 1P: 71.20%Odd: Make Bet
- 16:30 Lukko vs Vaasan Sport -Over 4.5 Goals: 76.50%Odd: Make Bet
- 16:30 Pelicans vs Hameenlinna -Over 4.5 Goals: 63.30%Odd: Make Bet
- 17:30 SaiPa vs Ilves -Over 4.5 Goals: 60.90%Odd: Make Bet
- 16:30 Tappara vs IFK Helsinki -Under 5.5 Goals: 65.90%Odd: 2.05 Make Bet
Mestis
- 16:30 IPK vs Kettera -Over 4.5 Goals: 83.80%Odd: Make Bet
- 16:30 Jokerit vs Hermes -Over 1.5 Goals in 1P: 65.10%Odd: Make Bet
- 16:30 Jokipojat vs RoKi -Over 4.5 Goals: 82.40%Odd: Make Bet
- 16:30 TuTo vs Nokian Pyry -Over 4.5 Goals: 55.00%Odd: Make Bet
France
Ligue Magnus
- 19:30 Anglet Hormadi vs Amiens -Over 4.5 Goals: 74.70%Odd: Make Bet
- 19:00 Briancon vs Rouen -Over 4.5 Goals: 78.80%Odd: Make Bet
- 19:30 Cergy Pontoise vs Bordeaux -Over 4.5 Goals: 91.80%Odd: Make Bet
- 19:00 GAP vs Chamonix -Under 5.5 Goals: 68.00%Odd: 1.67 Make Bet
- 19:15 Marseille vs Angers -Over 4.5 Goals: 75.30%Odd: Make Bet
Germany
DEL 1 Bundesliga
- 18:30 Dresdner Eislowen vs Frankfurt Löwen -Over 4.5 Goals: 83.00%Odd: Make Bet
- 18:30 EHC Munchen vs Adler Mannheim -Over 4.5 Goals: 77.90%Odd: Make Bet
- 18:30 ERC Ingolstadt vs Kolner Haie -Over 4.5 Goals: 88.00%Odd: Make Bet
- 18:30 Nurnberg Ice Tigers vs Straubing Tigers -Over 4.5 Goals: 77.40%Odd: Make Bet
- 18:30 Schwenninger Wild Wings vs Eisbaren Berlin -Over 4.5 Goals: 98.50%Odd: Make Bet
DEL 2 Bundesliga
- 18:30 Bad Nauheim vs ESV Kaufbeuren -Over 4.5 Goals: 89.40%Odd: Make Bet
- 18:30 Bietigheim Steelers vs Krefeld Pinguine -Over 4.5 Goals: 92.00%Odd: Make Bet
- 18:30 Dusseldorfer EG vs Lausitzer Fuchse -Over 1.5 Goals in 1P: 66.40%Odd: Make Bet
- 18:30 EV Landshut vs Kassel Huskies -Over 4.5 Goals: 81.70%Odd: Make Bet
- 18:30 Eispiraten Crimmitschau vs Wolfe Freiburg -Over 4.5 Goals: 76.40%Odd: Make Bet
- 19:00 Regensburg vs Ravensburg EVR Tower Stars -Under 5.5 Goals: 58.80%Odd: 1.83 Make Bet
- 19:00 Weiden vs Starbulls Rosenheim -Over 5.5 Goals: 73.00%Odd: 2.05 Make Bet
Great Britain
Elite League
- 19:30 Dundee Stars vs Guildford Flames -Odd: Make Bet
- 19:30 Manchester Storm vs Fife Flyers -Odd: Make Bet
- 19:00 Nottingham Panthers vs Belfast Giants -Odd: Make Bet
Hungary
Erste Liga
- 17:30 Dunaujvaros vs DVTK Jegesmedvek -Odd: Make Bet
- 17:30 Fehervari Titanok vs Csikszereda -Under 1.5 Goals in 1P: 87.20%Odd: Make Bet
- 17:40 MAC Budapest vs Gyergyoi -Over 4.5 Goals: 86.30%Odd: Make Bet
- 16:30 Ujpest vs Brasov -Over 5.5 Goals: 84.50%Odd: 1.67 Make Bet
International
Alps Hockey League
- 19:30 Cortina vs Bregenzerwald -Under 1.5 Goals in 1P: 69.30%Odd: Make Bet
Norway
Elitserien
- 19:30 Frisk Asker vs Valerenga -Under 5.5 Goals: 78.00%Odd: 1.70 Make Bet
- 18:00 Lorenskog vs Storhamar -Over 4.5 Goals: 65.30%Odd: Make Bet
- 18:00 Narvik IK vs Nidaros -Over 4.5 Goals: 89.60%Odd: Make Bet
- 18:00 Stavanger Oilers vs Lillehammer -Over 4.5 Goals: 67.50%Odd: Make Bet
- 17:00 Stjernen Hockey vs Sparta Sarpsborg -Over 4.5 Goals: 70.20%Odd: Make Bet
Poland
PHL
- 17:00 Ciarko Sanok vs Tychy -Over 4.5 Goals: 83.10%Odd: Make Bet
- 18:00 Jastrzebie vs Cracovia Krakow -Over 4.5 Goals: 68.00%Odd: Make Bet
- 17:30 TKH Torun vs Aksam Unia Oswiecim -Over 4.5 Goals: 90.20%Odd: Make Bet
- 16:00 Zaglebie Sosnowiec vs Katowice GKS -Over 4.5 Goals: 69.50%Odd: Make Bet
Russia
KHL
- 16:30 Lokomotiv Yaroslavl vs SKA St. Petersburg -Under 1.5 Goals in 1P: 75.30%Odd: Make Bet
- 14:00 Salavat Ufa vs Admiral Vladivostok -Over 4.5 Goals: 79.00%Odd: Make Bet
- 14:00 Traktor Chelyabinsk vs Barys Astana -Over 4.5 Goals: 82.10%Odd: Make Bet
- 14:00 Yekaterinburg vs Sibir Novosibirsk -Over 1.5 Goals in 1P: 60.90%Odd: Make Bet
MHL
- 16:00 AKM Junior vs JHC Spartak MAH -Over 4.5 Goals: 74.70%Odd: Make Bet
- 16:00 Kapitan Stupino vs Mikhaylov Academy U20 -Over 4.5 Goals: 59.40%Odd: Make Bet
- 15:30 Loko vs Atlanty -Over 4.5 Goals: 69.90%Odd: Make Bet
- 15:30 Reaktor vs Krasnoyarskie Rysi -Under 1.5 Goals in 1P: 76.70%Odd: Make Bet
- 08:00 Sakhalinskie Akuly vs Tayfun -Over 4.5 Goals: 83.80%Odd: Make Bet
- 11:30 Sibirskie Snaipery vs Molot Perm Juniors -Over 4.5 Goals: 93.20%Odd: Make Bet
- 15:30 Sputnik Almetievsk vs Tyumensky Legion -Over 4.5 Goals: 86.80%Odd: Make Bet
VHL
- 16:00 Buran Voronezh vs Chelmet Chelyabinsk -Under 5.5 Goals: 58.90%Odd: Make Bet
- 16:00 Chelny vs VVS Samara -Over 4.5 Goals: 68.80%Odd: Make Bet
- 16:00 HC Rostov vs Gornyak Uchaly -Over 4.5 Goals: 61.00%Odd: Make Bet
- 13:00 Omskie Krylia vs Khimik Voskresensk -Over 4.5 Goals: 66.50%Odd: Make Bet
- 13:30 Zauralie Kurgan vs Torpedo Gorky -Over 4.5 Goals: 71.90%Odd: Make Bet
Slovakia
1. Liga
- 17:00 HK Detva vs HC 19 Humenne -Over 4.5 Goals: 71.50%Odd: Make Bet
- 17:00 HK Levice vs Nove Zamky -Over 4.5 Goals: 61.90%Odd: Make Bet
- 16:00 Martin vs Dubnica -Under 1.5 Goals in 1P: 61.30%Odd: Make Bet
- 17:00 Pov. Bystrica vs TEBS Bratislava -Over 4.5 Goals: 83.00%Odd: Make Bet
- 16:30 Skalica vs Ziar nad Hronom -Over 4.5 Goals: 76.10%Odd: Make Bet
- 17:00 Topolcany vs Trnava -Over 1.5 Goals in 1P: 81.00%Odd: Make Bet
Extraliga
- 16:30 B. Bystrica vs Trencin -Under 5.5 Goals: 68.30%Odd: 1.65 Make Bet
- 17:00 Nitra vs Michalovce -Over 4.5 Goals: 83.00%Odd: Make Bet
- 17:00 Poprad vs Zilina -Over 4.5 Goals: 77.30%Odd: Make Bet
- 17:30 Slovan Bratislava vs Presov -Over 1.5 Goals in 1P: 72.80%Odd: Make Bet
- 16:30 Spisska N. Ves vs Kosice -Over 4.5 Goals: 64.50%Odd: Make Bet
- 17:00 Zvolen vs Liptovsky Mikulas -Over 4.5 Goals: 87.60%Odd: Make Bet
Sweden
Hockeyallsvenskan
- 18:00 AIK vs Vimmerby -Over 4.5 Goals: 63.00%Odd: Make Bet
- 18:00 Almtuna vs Ostersund -Over 4.5 Goals: 88.00%Odd: Make Bet
- 18:00 BIK Karlskoga vs Nybro -Over 4.5 Goals: 79.90%Odd: Make Bet
- 18:00 Bjorkloven vs Troja/Ljungby -Over 4.5 Goals: 94.80%Odd: Make Bet
- 18:00 Modo vs Vasteras -Over 5.5 Goals: 68.00%Odd: 1.91 Make Bet
- 18:00 Mora vs Kalmar HC -Over 4.5 Goals: 74.10%Odd: Make Bet
- 18:00 Oskarshamn vs Sodertalje -Over 4.5 Goals: 67.50%Odd: Make Bet
Switzerland
National League
- 18:45 Ajoie vs Ambri -Under 5.5 Goals: 67.90%Odd: 1.67 Make Bet
- 18:45 Biel vs Bern -Under 1.5 Goals in 1P: 63.10%Odd: Make Bet
- 18:45 Rapperswil vs Fribourg -Over 4.5 Goals: 88.00%Odd: Make Bet
- 18:45 Zurich vs SC Langnau Tigers -Over 4.5 Goals: 74.80%Odd: Make Bet
Swiss League
- 18:45 Basel vs Olten -Under 5.5 Goals: 70.00%Odd: Make Bet
- 19:00 Chur vs Thurgau -Under 5.5 Goals: 83.90%Odd: Make Bet
- 18:45 La Chaux-de-Fonds vs GCK Lions -Over 4.5 Goals: 99.00%Odd: Make Bet
- 18:45 Visp vs Arosa -Under 5.5 Goals: 82.60%Odd: Make Bet
- 19:00 Winterthur vs HC Sierre -Over 4.5 Goals: 88.00%Odd: Make Bet
USA
AHL
- 01:30 (2P’) Coachella Firebirds vs San Diego Gulls 2-1
- 23:00 Hartford Wolf Pack vs Lehigh Phantoms -Over 1.5 Goals in 1P: 74.00%Odd: Make Bet
- 23:00 Laval Rocket vs Rochester Americans -Odd: Make Bet
- 23:05 Springfield vs Hershey -Odd: Make Bet
- 23:00 Syracuse vs Utica Comets -Odd: Make Bet
- 23:05 Wilkes Barre vs Bridgeport Islanders -Odd: Make Bet
NHL
- 01:00 (2P’) Edmonton Oilers vs New York Rangers 1-1Over 4.5 Goals: 63.10%
- 02:30 Los Angeles Kings vs Detroit Red Wings -Over 1.5 Goals in 1P: 56.80%Odd: Make Bet
- 00:00 (3P’) Minnesota Wild vs Pittsburgh Penguins 1-3Over 1.5 Goals in 1P: 67.50%
- 02:00 (1P’) San Jose Sharks vs New Jersey Devils 1-0Over 4.5 Goals: 84.80%
- 00:00 (3P’) St Louis Blues vs Vancouver Canucks 3-3Over 4.5 Goals: 69.10%
- 20:00 Vegas Golden Knights vs Colorado Avalanche -Over 4.5 Goals: 86.60%Odd: Make Bet
- 23:00 Washington Capitals vs New York Islanders -Over 4.5 Goals: 89.50%Odd: Make Bet
- 00:00 (3P’) Winnipeg Jets vs Chicago Blackhawks 5-2Over 4.5 Goals: 93.90%
Ukraine
UHL
- 16:00 Odeshchina vs Kremenchuk -Odd: Make Bet
Stay Updated with Today's Ice Hockey Matches
As a passionate ice hockey fan in Kenya, you know the thrill of watching live matches and the excitement of making informed betting predictions. Our platform is dedicated to providing you with the latest updates on today's ice hockey matches, ensuring you never miss a beat. With expert analysis and daily updates, you can stay ahead of the game and make strategic bets with confidence.
Why Choose Our Expert Betting Predictions?
Our team of seasoned analysts brings years of experience to the table, offering insights that go beyond mere statistics. We delve deep into team dynamics, player performances, and historical data to provide you with predictions that are not only accurate but also insightful. Whether you're a seasoned bettor or new to the game, our predictions are designed to enhance your betting strategy and increase your chances of success.
Today's Match Highlights
- Team A vs. Team B: A classic showdown that promises high stakes and intense action. Our experts predict a close game with Team A having a slight edge due to their recent form.
- Team C vs. Team D: This match features two teams known for their defensive prowess. Expect a low-scoring game, but don't be surprised if Team D pulls off an upset.
- Team E vs. Team F: With Team E's star player returning from injury, this match is expected to be explosive. Our predictions favor Team E, but keep an eye on Team F's counter-attacks.
How to Make Informed Betting Decisions
Betting on ice hockey can be both exhilarating and challenging. To help you navigate the complexities, we offer the following tips:
- Analyze Team Form: Look at the recent performances of both teams. A team in good form is more likely to win.
- Consider Player Injuries: Injuries can significantly impact a team's performance. Stay updated on injury reports.
- Study Head-to-Head Records: Historical data can provide insights into how teams perform against each other.
- Watch for Trends: Identify any patterns in gameplay or betting odds that could influence your decision.
Daily Match Updates
We provide real-time updates on today's matches, ensuring you have the latest information at your fingertips. From line-up changes to last-minute strategies, our updates cover everything you need to know to stay informed.
Betting Strategies for Today
To maximize your betting potential, consider these strategies:
- Bet on Over/Under Goals: Given the defensive nature of today's matches, betting on under goals might be a smart move.
- Lay Bets on Favorites: If a team is heavily favored, consider laying bets against them for potentially higher returns.
- Diversify Your Bets: Spread your bets across different matches to minimize risk and increase chances of winning.
Expert Analysis: Team A vs. Team B
This match is one of the highlights of today's schedule. Team A has been in excellent form recently, winning four out of their last five matches. Their key player, John Smith, has been on fire, scoring multiple goals in each game. On the other hand, Team B has shown resilience despite a few setbacks. Their defense has been solid, conceding only two goals in their last three matches.
Our expert analysis suggests that while Team A has the upper hand, Team B's defensive strategy could make this a closely contested match. Betting on Team A to win with over 2.5 goals might be a wise choice given their offensive prowess.
Tips for New Bettors
If you're new to betting on ice hockey, here are some tips to get you started:
- Start Small: Begin with small bets to familiarize yourself with the process and minimize potential losses.
- Educate Yourself: Read up on ice hockey rules and betting terminology to make informed decisions.
- Maintain Discipline: Set a budget for your bets and stick to it to avoid overspending.
Daily Betting Tips
To help you make the most of today's matches, here are some daily betting tips:
- Favor Underdogs Carefully: While underdogs can offer high returns, they come with higher risks. Choose wisely based on thorough analysis.
- Leverage Bonuses: Many betting platforms offer bonuses for new users or for placing your first bet. Take advantage of these offers where possible.
- Monitor Live Odds: Keep an eye on live odds as they can shift dramatically during a match based on real-time events.
In-Depth Analysis: Team C vs. Team D
This match is expected to be a tactical battle between two defensively strong teams. Both teams have struggled offensively this season but have managed to keep their goal difference minimal through solid defense.
Team C has had a slightly better run recently, securing two draws against top-tier teams. Their goalkeeper has been exceptional, making crucial saves in critical moments. Meanwhile, Team D has relied heavily on counter-attacks to score goals. Their agility and speed make them dangerous when they gain possession in the opponent's half.
Betting experts suggest that this match might end in a draw or with fewer than three goals scored in total. If you're looking for safer bets, consider placing money on under 2.5 goals or backing a draw as the final result.
Making Use of Expert Predictions
To fully leverage our expert predictions, follow these steps:
- Familiarize Yourself with Our Experts' Track Record: Check their past predictions and accuracy rates before placing your bets based on their advice.
- Cross-Verify Information: Use multiple sources to confirm the insights provided by our experts for more reliable predictions.
- Create a Betting Plan: Develop a structured plan based on expert advice and stick to it throughout the day's matches.
Betting Opportunities: Team E vs. Team F
This match is highly anticipated due to the return of Team E's star player after an injury layoff. His presence is expected to boost Team E's attacking capabilities significantly.
Team F has been inconsistent this season but has shown flashes of brilliance when playing at home. Their recent form suggests they might struggle against stronger opponents like Team E.
Betting experts recommend backing Team E to win outright or considering an over/under bet favoring over 2 goals due to the offensive potential introduced by their star player's return.
The Importance of Staying Updated
In the fast-paced world of ice hockey betting, staying updated is crucial for making informed decisions. Here’s why it matters:
- Rapid Changes in Form and Strategy: Teams can change form quickly due to various factors such as injuries or tactical shifts by coaches.
- Last-Minute Line-Up Changes: Players might be benched or substituted at short notice due to unforeseen circumstances like injuries during warm-ups or strategic decisions by coaches.
- Variations in Weather Conditions: In outdoor venues (though rare for ice hockey), weather conditions can impact gameplay significantly and alter predicted outcomes.
Daily Betting Insights
To help you navigate today’s betting landscape, here are some additional insights:
- Analyze Weather Reports: If applicable, check weather conditions as they can affect players' performance and game dynamics.
- Follow Social Media Updates: Social media platforms often provide real-time updates from credible sources about team news and player conditions.
- Leverage Mobile Apps: Maintain access to mobile apps from reputable sports news outlets for instant notifications about any developments affecting today’s matches.
Tips for Effective Betting Today
To enhance your betting experience today, consider these final tips:
- Maintain Emotional Control: Avoid making impulsive bets driven by emotions rather than logic and analysis.
- Evaluate Each Bet Carefully: Analyze all available data before placing any bets rather than relying solely on gut feelings or hunches about team performance.
- Avoid Chasing Losses: If you experience losses early in the day’s matches, resist increasing bet sizes impulsively as this could lead to greater financial strain without improving outcomes necessarily. <|repo_name|>tiochris/tiochris.github.io<|file_sep|>/_posts/2016-01-03-ruby-gem-skeleton.md --- layout: post title: "Ruby Gem Skeleton" date: "2016-01-03T00:00:00Z" categories: - Ruby --- I've created [a skeleton project][1] for Ruby gems. [1]: https://github.com/tiochris/ruby-gem-skeleton The motivation behind it was basically: * I want my gems' source code always reside under `lib` directory. * I want my tests reside under `spec` directory. * I want my executables reside under `bin` directory. * I want my gemspec file reside under root directory. And I wanted it all set up automatically. So now I can just do: $ mkdir my-new-gem $ cd my-new-gem $ git init . $ git remote add origin [email protected]:tiochris/my-new-gem.git $ curl https://raw.githubusercontent.com/tiochris/ruby-gem-skeleton/master/skeleton.rb | ruby - my-new-gem And all will be set up: * `.gitignore` * `Rakefile` * `Gemfile` * `my-new-gem.gemspec` * `lib/my_new_gem.rb` * `bin/my_new_gem` * `spec/my_new_gem_spec.rb` Now just open `my-new-gem.gemspec` file with editor and edit values as necessary. If you want only part of files set up (for example if you already have `.gitignore`), pass `-s` option: $ curl https://raw.githubusercontent.com/tiochris/ruby-gem-skeleton/master/skeleton.rb | ruby -s - my-new-gem Enjoy!<|repo_name|>tiochris/tiochris.github.io<|file_sep|>/_posts/2016-01-07-ruby-code-reuse-between-two-methods.md --- layout: post title: "Ruby Code Reuse Between Two Methods" date: "2016-01-07T00:00:00Z" categories: - Ruby --- Sometimes we need two methods which differ only by one line. For example: ruby def foo(arg) # Some code here # One line differs between methods puts 'Foo!' # Some code here end def bar(arg) # Some code here # One line differs between methods puts 'Bar!' # Some code here end We could refactor it like this: ruby def foo(arg) execute_foo_bar('Foo!', arg) end def bar(arg) execute_foo_bar('Bar!', arg) end private def execute_foo_bar(message_to_print_outside_of_method,arg) # Some code here # One line differs between methods puts message_to_print_outside_of_method # Some code here end But then we have unnecessary abstraction level. There are also some other ways we could refactor it like this: ruby def foo(arg) execute_foo_bar('Foo!', arg) end def bar(arg) execute_foo_bar('Bar!', arg) { } end private def execute_foo_bar(message_to_print_outside_of_method,arg,&block) # Some code here # One line differs between methods puts message_to_print_outside_of_method block.call if block_given? # Some code here end Or even this way: ruby def foo(arg) execute_foo_bar('Foo!', arg) do |message_to_print_outside_of_method| end end def bar(arg) execute_foo_bar('Bar!', arg) do |message_to_print_outside_of_method| puts message_to_print_outside_of_method end end private def execute_foo_bar(message_to_print_outside_of_method,arg,&block) block.call(message_to_print_outside_of_method) if block_given? # Some code here # One line differs between methods puts message_to_print_outside_of_method unless block_given? # Some code here end Or even using [`yield`](http://www.ruby-doc.org/core-2.1/Yield.html): ruby def foo(arg) execute_foo_bar('Foo!', arg) do |message_to_print_outside_of_method| end end def bar(arg) execute_foo_bar('Bar!', arg) do |message_to_print_outside_of_method| puts message_to_print_outside_of_method end end private def execute_foo_bar(message_to_print_outside_of_method,arg,&block) block.call(message_to_print_outside_of_method) if block_given? # Some code here yield(message_to_print_outside_of_method) unless block_given? # Some code here puts message_to_print_outside_of_method unless block_given? end But I personally prefer using [`Proc`](http://www.ruby-doc.org/core-2.1/Proc.html) class: ruby def foo(arg) execute_foo_bar('Foo!', arg) { } end def bar(arg) execute_foo_bar('Bar!', arg) { |message_to_print_outside_of_method| puts message_to_print_outside_of_method } end private def execute_foo_bar(message_to_print_outside_of_method,arg,&block) execute_code_reuse_proc = Proc.new { puts message_to_print_outside_of_method } block = execute_code_reuse_proc if block.nil? block.call # Some code here block.call if block != execute_code_reuse_proc # Some code here block.call if block == execute_code_reuse_proc end And there is no extra abstraction level now.<|repo_name|>tiochris/tiochris.github.io<|file_sep|>/_posts/2016-01-08-ruby-use-rails-console-from-code.md --- layout: post title: "Ruby Use Rails Console from Code" date: "2016-01-08T00:00:00Z" categories: - Ruby/Rails/Rake Task/Rake Task/Rails Console/Rails Console Command/Rails Console Command from Rake Task/Rails Console Command from Rake Task/Rails Console Command from Code/Rails Console Command from Code/ --- I needed some way how run command like this inside rake task: ruby rails console -e development -c 'Model.count' I came up with something like this: ruby rails = 'bundle exec rails' console = "#{rails} console" environment = '-e development' command = '-c' code = "'Model.count'" system("#{console} #{environment} #{command} \"#{code}\"") Which works great. However then I found out about [`rails runner`](http://guides.rubyonrails.org/command_line.html#rails-runner). So now I have something like this: ruby rails = 'bundle exec rails' runner = "#{rails} runner" environment = '-e development' code = 'puts Model.count' system("#{runner} #{environment} \"#{code}\"") And it works even better.<|file_sep|># Site settings title: TIOChris - Chris Todoroviciu's Blog email: description: baseurl: url: twitter_username: github_username: collections: posts: output: true # needed because default output value is false<|repo_name|>tiochris/tiochris.github.io<|file_sep|>/_posts/2016-01-04-rails-run-migrations-and-test-database.md --- layout: post title: "Rails Run Migrations and Test Database" date: "2016-01-04T00:00:00Z" categories: - Ruby/Rails/Rake Task/Rake Task/Rails Migrations/Rails Migrations Test Database/ --- Sometimes I forget how run migrations against test database. So now I'm putting it down somewhere so next time I won't forget again. Run migrations against test database (without migrations lock file): bundle exec rake db:migrate RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1 Run migrations against test database (with migrations lock file): bundle exec rake db:migrate RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1 VERSION=$(bundle exec rake -s db:migrate:redo VERSION=0 RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1) Run pending migrations against test database (without migrations lock file): bundle exec rake db:migrate RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1 VERSION=$(bundle exec rake -s db:migrate:redo VERSION=0 RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1) Run pending migrations against test database (with migrations lock file): bundle exec rake db:migrate RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1 VERSION=$(bundle exec rake -s db:migrate:redo VERSION=$(bundle exec rake db:schema_migrations RAILS_ENV=test) RAILS_ENV=test DISABLE_DATABASE_ENVIRONMENT_CHECK=1)<|repo_name|>tiochris/tiochris.github.io<|file_sep|>/_posts/2016-01-02-rails-multiple-databases.md --- layout: post title: