-
Yet another hack how to enable the syntax highlighting for the byebug gem.
-
Works for v10.0.0 and higher.
-
Place the content of byebug_syntax_highlighting.rb somewhere in your codebase (Inside an initializer for example, if you are using Rails).
-
Do not forget to include byebug and rouge to the Gemfile as well.
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
data = request_result | |
// target the array of projects | |
projects = request_result.data.projects.group | |
// target the array of repos | |
repos = data.data.repo.edges | |
// get the strings we need to filter on as source | |
source = repos.map(function(repo) { return repo.node.relativePath }) |
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
FR0010592105 | |
FR0010718312 | |
FR0010105411 | |
FR0010358986 | |
LU0998992639 | |
LU1881735861 | |
LU0276015889 | |
LU1319654866 | |
LU1914343311 | |
LU1914341026 |
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
const writeData = (data, contentElt) => { | |
contentElt.innerHTML = ` | |
<p>Name is ${data.person.name.fullName}</p> | |
<p>Company is ${data.company.name}</p> | |
` | |
}; | |
const getInfoFromClearbit = (e) => { | |
const contentElt = document.getElementById('content'); | |
e.preventDefault(); |
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
POSSIBLE_OPERATORS = %w(* / + - %) | |
def process_calculation(first_number, second_number, operator) | |
return nil unless POSSIBLE_OPERATORS.include? operator | |
# case operator | |
# when "+" | |
# first_number.+(second_number) | |
# when "-" | |
# first_number.-(second_number) | |
# when "*" |
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
$products = [ | |
{ | |
name: "kiwi", | |
price: 5, | |
stock: 20 | |
}, | |
{ | |
name: "banane", | |
price: 3, | |
stock: 3 |
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
def process_calculation(first_number, second_number, operator) | |
first_number.send(operator, second_number) | |
end |
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
require "date" | |
def count_days_to_christmas(date = Date.today) | |
#today = Date.new(2018, 12, 26) | |
christmas = Date.new(date.year, 12, 25) | |
if date > christmas | |
christmas = Date.new(date.year+1, 12, 25) | |
end | |
(christmas - date).to_i | |
end |
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
# def compute(a, b, operator) | |
# case operator | |
# when "+" then a + b | |
# when "-" then a - b | |
# when "*" then a * b | |
# when "/" then a / b | |
# when "%" then a % b | |
# else "Not implemented" | |
# end | |
# end |
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
# create cookie at sign in | |
cookies[:redirect] = { | |
:value => 'yes', | |
:expires => 1.year.from_now, | |
:domain => '.mydomain.com' | |
} | |
# delete cookie at sign out | |
cookies.delete :redirect, domain: '.mydomain.com' |
NewerOlder