teleren/devto huggingface dataset:
Using Mustache in Ruby for Logic-less Templates
Tags: ruby, showdev
Published: 2022-12-01 13:18:33

Ruby is a popular programming language known for its simplicity, flexibility, and power. One of the strengths of Ruby is its ecosystem of libraries and frameworks that make it easy to build web applications and other software.

In this blog post, we will show you how to use the **Mustache** gem in Ruby to create logic-less templates. Mustache is a popular templating system that allows you to separate the logic of your application from the presentation of your data.

First, let's install the Mustache gem. If you don't have it already, you can install it using gem like this:

```ruby
gem install mustache
```

Once the gem is installed, you can use it in your Ruby code like this:

```ruby
require "mustache"

template = "Hello, {{ name }}!"
data = { name: "John" }

renderer = Mustache.new
output = renderer.render(template, data)

puts output
# => "Hello, John!"
```

his code defines a Mustache template with a placeholder for the **name** variable, and a data hash that contains the value for **name**. The **Mustache.new** method creates a new Mustache renderer, and the **render** method applies the data to the template and returns the output.

As you can see, Mustache allows you to write templates that contain only the presentation of your data, without any logic. The logic of your application is handled separately, in your Ruby code. This makes it easy to manage and maintain your templates, and also makes them reusable across different parts of your application.

Mustache also supports more advanced features, such as loops and conditionals. Here is an example of how to use these features in a Mustache template:

```ruby
template = "
  {{# names }}
    Hello, {{ name }}!
  {{/ names }}
"

data = {
  names: [
    { name: "John" },
    { name: "Jane" },
    { name: "Joe" },
  ]
}

renderer = Mustache.new
output = renderer.render(template, data)

puts output
# => "Hello, John! Hello, Jane! Hello, Joe!"
```

In this example, the template contains a loop that iterates over the names array in the data hash, and prints a greeting for each name. The ```{{# names }}``` and ```{{/ names }}``` tags are used to define the loop, and the ```{{ name }}``` tag is used to insert the value of the name property of each element in the array.

Overall, the Mustache gem is a powerful tool that makes it easy to create logic-less templates in Ruby. It allows you to separate the logic of your application from the presentation of your data, and provides a simple and flexible syntax for creating templates.

I hope this blog post has given you an introduction to using **Mustache** in Ruby. If you have any questions, feel free to leave a comment below.
Advent Of Code 2022 in PHP
Tags: php, adventofcode, algorithms
Published: 2022-12-01 13:14:49

**Hi everyone !**
First post here for December 1st and not a coincidence because this year I join the annual challenge Advent Of Code 2022 and created by @ericwastl (you can find him on Twitter).

I code in PHP so let me share with you my code if you want to do it with the same language let me know and let's talk about your reflexion ^^

Let's go and I hope I'll find the motivation to complete this challenge until the 25th !!

Get the first kata after log in : https://adventofcode.com/2022/day/1

```
<?php

$input = file_get_contents('inputs/day01');
$lines= explode("
", $input);

// Part 1 
$sum = array_reduce($lines, function($carry, $item) {
    if (empty($item)) {
        $carry[] = 0;
    } else {
        $carry[count($carry)-1] += $item;
    }
    return $carry;
}, [0]);

// Get the max : 
// var_dump(max($sum));

// Part 2

function getThreeElvesCalories($input){
    $sortSum = rsort($input);
    $array= [];
    for($i=0; $i<3; $i++){
        $array[] = $input[$i];
    }
    return array_sum($array);
}
print_r(getThreeElvesCalories($sum));

```
Outreachy: Introducing myself with Eclipse Adoptium
Tags: outreachy, opensource, eclipseadoptium, sbom
Published: 2022-12-01 13:11:57

| Outreachy |
|----------|
| [1. Outreachy: Introducing myself with Eclipse Adoptium](https://dev.to/julian55455/outreachy-introducing-myself-with-eclipse-adoptium-3bam)   |
| [2. Outreachy: Everyone Struggles](https://dev.to/julian55455/outreachy-everyone-struggles-1cn1)|
| [3. Outreachy: Experience with Adoptium](https://dev.to/julian55455/experience-with-eclipse-adoptium-2c3m)| 

## Introducing myself with Eclipse Adoptium
Hi All,
My name is Atuhwera Julian, an opensource evangelist and a junior software engineer with a passion for developing innovative programs that expedite the efficiency and effectiveness of organizational success. I have been in back-end development for 2 years using java and node and am always open to learning new back-end technologies.

I was just chosen as an Outreachy intern for the cohort from December 2022 to March 2023. My mentors are Shelley Lambert, Wen Zhou and Andrew Leonard and I will be collaborating with Eclipse Adoptium community on the project "Software Bill of Materials Refinements (Codename "SmoothBOM")"

It's honestly hard to express how excited I am for this project in just a text. I can't wait for 5th Dec to get started. My goal is to make this project the best it can be

This was my third time applying on outreachy projects since the competition is always stiff and it seemed like a mystery to be selected for any of these projects. I kept pushing and learning new stuff until I finally saw what was a dream come to pass. Am grateful to all mentors who were there to support during the contribution period and all lessons taught. I will forever be grateful. During the contribution period I added on both my technical skills and non-technical skills like communication and proposal writing.

I with honest heart encourage those who have been applying to outreachy and things don't work out, don't give up as yet because winning is for everyone and its part of the process
Memory layout in C++
Published: 2022-12-01 12:58:31


# automatic storage
 - exists till the function ends.**
   -> only useable in the scope
 - automatic variable is variable used in function.
 - allocated in **stack**
   -> last-in, first-out
## example in automatic storage
```Cpp
int main()
{
    char temp[42]; // this is automatic variable
    return (0);
}

```

# static storage
 - exists till program ends.
 - allocated in **data**

## example in static storage
```Cpp
int main()
{
    static char temp[42]; // this is static variable
    return (0);
}

```

# dynamic storage
 - exits till `delete` is called.
 - `new` and `delete` operators manage memory poll (a.k.a free store)
 - allocated in **heap**
 - depend to programmer. 
     - WATCH MEMORY LEAKS
         - recommend : locate `new` and `delete` close.

## example in dymaic storage
```Cpp
int main()
{
    int *ptr = new int(42);
    delete ptr;
    return (0);
}

```

# reference
- https://hackthedeveloper.com/memory-layout-c-program/
- C++ Primer Puls sixth edition(Stephen Prata)
The 7 large Indications of an Underperforming Online Marketing
Tags: webdev, beginners
Published: 2022-12-01 12:44:08


![Uploading image](...)
Digital Marketing is a vast and dynamic area that involves weeks or months of brainstorming, research, analysis, strategy, planning, and more to gain more attention besides attracting prospects, leads, and sales. An effective digital marketing strategy follows metrics that bring in revenue besides ensuring that it adheres to the algorithm of Google.
With the time-to-time change in Google’s algorithm, it is necessary to make sure that the marketing strategy generates the best results and the expected outcome. In the case of underperformance or other digital marketing fails, it is crucial to look out for these 7 signs to make an overhaul.
 

**Seven major parts:**

No Maximization in the ROI
Traffic doesn’t turn into conversion
Social campaigns are falling flat
Difficulty in finding your website on Google Search Results
Strategy adjustments aren’t making a difference
Lack of multichannel marketing strategies
Not aware of the performance of your campaigns

Click here to learn more: Digital marketing strategy
Access your computer's files from your phone
Tags: prolog, web, editor, computer
Published: 2022-11-30 13:45:06

---
title: Access your computer's files from your phone
published: true
description: Use a Prolog web app to access your computer
tags: prolog, web, editor, computer
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-30 13:33 +0000
---

Image: An open laptop in a desert with mountains in the background.
![an-open-laptop-sitting-on-cracked-desert-floor-with-mountains-in-the-background-2276729](https://user-images.githubusercontent.com/15845542/204810243-fe1919c3-9a1f-452e-a8cf-8e35df8c8a4b.jpg)

Have you ever needed to access or develop with files on your computer?  You can use a web editor that accesses your files which runs on your computer, and can be accessed on your phone.  Note: Web Editor is password-protected to prevent access to files.

Here's how to access your files from your phone (and later, run Prolog files using your computer as a web server):
1. Download the Philosophy repository from https://github.com/luciangreen/Philosophy.
2. In `swipl` (SWI-Prolog, which you also need to install), load `['web-editor.pl'].`
3. Start the server: `server(8000).`
4. Find your computer's IP address.  On Mac, search for IP address (TCP/IP) in settings.
5. On your phone, go to `http://***IP address***:8000`.
6. The web editor program lets you open or edit, move, copy and delete files and folders on your computer.  (Planned: creating new folders and files, and displaying the folder name.)

![FXTQTrhVEAA06ae](https://user-images.githubusercontent.com/15845542/204939418-74f98102-7191-4cf6-937f-593db5d28547.jpeg)
Figure 1. Open, edit, move, copy and delete files and folders with Web Edit.

![FXTQTreVQAEV_61](https://user-images.githubusercontent.com/15845542/204939426-12243ea1-2c53-4a0a-a7d9-7962f00daa80.jpeg)
Figure 2. The Web Edit text file editor.

* PS. To maintain a connection from your phone to your computer over a longer distance, you may need to install Web Edit and the files to edit on a <a href="https://github.com/luciangreen/Text-to-Breasonings/blob/master/Setting_up_a_VPS_with_TextToBr.txt">Virtual Private Server</a>, which can be subscribed to from a number of providers (search online) for a price.

Next: Run List Prolog on the Web
https://dev.to/luciangreen/run-list-prolog-on-the-web-1dfd

Image by Free Images/Thinkstock.
Terraforming all the things
Published: 2022-12-11 10:12:39

---
title: Terraforming all the things
published: true
date: 2022-12-01 12:08:27 UTC
tags: 
canonical_url: https://write.as/kelvintaywl/terraforming-all-the-things?pk_campaign=rss-feed
---

![](https://i.snap.as/mcpXL4Xe.jpg)

Infrastructure as Code (IaC) is not a new concept for many. Prior to joining CircleCI, I have been wrangling with AWS CloudFormation long enough (2 years) to bear some of its pain-points.

Since joining CircleCI, I have been exposed to Terraform through internal and external projects. So far, I really like that Terraform is not tied to specific cloud providers.

I also like that any service can contribute a [Terraform provider](https://registry.terraform.io/browse/providers), thereby allowing users to define your service's resources as code. (Any cloud resource that exposes an CRUD / RESTful API is a good candidates for Terraform.)

Recently, I have been wishing many things to be “Terraform-able”.

As a support engineer, I use Zendesk daily. We create [Zendesk macros](https://support.zendesk.com/hc/en-us/articles/4408844187034#topic_zlk_nf1_dsb) for canned responses in particular. Overtime, these macros grow, and it may be hard to manage or validate changes to our macros. I do wish Zendesk has a Terraform provider, so we can institute our macros in code.

Recently, I also wished that I could Terraform my resume. Then, I snapped out of it.

When you have a powerful hammer like Terraform, everything looks like nails.

[#terraform](https://write.as/kelvintaywl/tag:terraform) [#infrastructureascode](https://write.as/kelvintaywl/tag:infrastructureascode) [#declarative](https://write.as/kelvintaywl/tag:declarative)

[buy Kelvin a cup of coffee](https://www.buymeacoffee.com/kelvintaywl) ☕
The 2022 December CI Challenge
Tags: programming, beginners, devops, opensource
Published: 2022-12-01 11:40:00

---
title: The 2022 December CI Challenge
published: true
description: A challenge to set up CI for a different Open Source project every day
tags: programming, beginner, devops, opensource
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
published_at: 2022-12-01 11:40 +0000
canonical_url: https://code-maven.com/2022-december-ci-challenge
series: ci-2022-12
---

[Advent Calendars](/szabgab/advent-calendars-in-2022-1kic) and [Advent Code Challenges](https://dev.to/jarvisscript/2022-advent-code-challenges-5445) are all the rage these days.

I am going to combine the ideas and write an article every day on how I configured Continuous Integration for an Open Source project and I would like to **challenge you** to do the same!

This is going to be a series of articles (and videos) on setting up Continuous Integration (CI) for Open Source projects.

Each day during December 2022 (well, at least till the 25th) I am going to configure CI for an open source project.

Every day I'll try to find something different. A different programming language, a different VCS hosting service, maybe some different extras that are needed (a database, etc.)

However this challenge is not only for me. I hope that **you will also join me** on this crazy journey, find a project that does not have CI yet, write some test if there are non, set up the CI, send the pull-request, and then post a link to it as a comment on the days post.

The **VCS hosting services**: I know most of the open source projects are hosted on [GitHub](https://github.com/). A lot less on [GitLab](https://gitlab.com/). I'd be glad to hear about other hosting services where there are Open Source projects.

Where can you find projects? You can search for them on the web site of the VCS hosting service or on one of the digger
projects I've been building. The currently existing projects are [PyDigger](https://pydigger.com/) for **Python**, [CPAN Digger](https://cpan-digger.perlmaven.com/) for **Perl**, and the [Ruby Digger](https://ruby-digger.code-maven.com/) for, well, **Ruby**.

## Let's get started!

If you are interested to participate, follow me, and comment below which (programming) languages are you interested the most. If you have suggestion for specific project, link to the repositories of those as well!
Next js developer Hiring
Tags: nextjs
Published: 2022-12-01 11:00:53

Programming designer administrations suppliers offer administrations to help organizations create and make programming in light of the prerequisites of their client. At times, programming engineer suppliers can likewise be recruited to upgrade a business' current item. These suppliers will gauge the time and cost of a venture, then, at that point, will configuration, create, test, and convey the item to the client.

These suppliers assist organizations that with doing not have a full programming improvement group to make new items and keep up with existing items. Organizations that have programming improvement groups can likewise profit from programming designer suppliers in times when the group needs help on an undertaking or just for conference purposes. some of the important services are:


1.  Web developer
2. [next js developer](https://www.timetoremote.com/next-js-developers/)
3. app developer
4. ios developer
5. [react developer](http://www.timetoremote.com/react-js-development-company/)
6. application developer


As well as employing a product designer, numerous organizations might decide to recruit testing and QA suppliers to test a recently evolved item on the off chance that the product engineer suppliers don't offer it. At times, it's worth the effort for the business to employ programming engineer suppliers that work in a particular region relying upon the undertaking. For instance, a business that is hoping to make an iOS application might need to employ iOS engineers since they spend significant time in iOS applications.

To fit the bill for consideration in the Product Designer Administrations Suppliers classification, a supplier must:

Configuration, create, QA and convey programming
Furnish designers with a particular set or assortment of specialities
Answer client input and give plan changes when mentioned
9. Palindrome Number - JavaScript Solution - by Abu Saleh Faysal
Tags: javascript, leetcode, programming
Published: 2022-12-01 10:55:38

Checking "Palindrome number" is a very widespread problem. Compared to the other languages, I found it easier to solve this problem with JavaScript.

## Solution:
**Step 01:** Convert x into string using toString().
**Step 02:** Split the string using split().
**Step 03:** Reverse the string using reverse().
**Step 04:** Join the string using join().
**Step 05:** Convert the string into number using Number().
**Step 06:** Check whether the number is equal to the parameter x or not.

```
/**
 * @param {number} x
 * @return {boolean}
 */
var isPalindrome = function (x) {
    return x === Number(x.toString().split("").reverse().join(""));
};
```

If you want me to publish more posts like this, Buy me a coffee.

👉 YouTube Channel Link: https://www.youtube.com/channel/UCW_09Nbobf4URLkAlEo84sw
👉 PlayList Link: https://youtube.com/playlist?list=PLUnklBXn8NSefCpBaLe39mds6dQx-tDDD

👉 Connect with me (LinkedIn): https://www.linkedin.com/in/abusalehfaysal
👉 Follow our LinkedIn Page:
👉 Like our Facebook page: https://www.facebook.com/thebacklogprogrammer/
👉 Join our community (Facebook group): https://www.facebook.com/groups/5500588936676942/
👉 Follow me at: https://www.facebook.com/AbuSalehFaysal10
👉 Twitter: https://twitter.com/AbuSalehFaysal

👉 Abu Saleh Faysal’s Blog: https://abusalehfaysal.hashnode.dev/
👉 Hasnode: https://hashnode.com/@AbuSalehFaysal
👉 Dev Community: https://dev.to/abusalehfaysal
👉 freeCodeCamp: https://www.freecodecamp.org/abusalehfaysal
👉 Medium: https://abusalehfaysal.medium.com/

👉 GitHub: https://github.com/AbuSalehFaysal
👉 GitLab: https://gitlab.com/AbuSalehFaysal
What is Passkey?
Tags: passkey, passwordless, webauthn, biometrics
Published: 2022-12-01 10:50:56

Passkey authentication solves the problem of password logins. Passwords are not only difficult to remember, but they are also easy to forget and can be guessed by criminals. Passkey authentication is a solution that provides a more secure way for users to access online services. It allows users to authenticate themselves by entering a pin or scanning their fingerprint, both of which are difficult to guess or steal from the user’s device.

Tech giants such as Apple, Google, and PayPal have already started to embrace password-free authentication method—passkey—that eliminates the need for using passwords during signup or logins.

Learn everything about - what passkey is, how passkey authentication works, how to recover a passkey, and how passkey is different from password. 

[Read On](https://mojoauth.com/blog/what-is-passkey/)
Ruby#lazy
Tags: ruby, rails
Published: 2022-12-01 10:13:59

Here is an advanced tip for working with the Ruby programming language:

When working with large collections of data in Ruby, it is often useful to use the **Enumerable#lazy** method. This method creates a "lazy" enumerable, which means that it will only generate and return the items in the collection as they are needed, rather than generating and returning the entire collection at once.

Using a lazy enumerable can be particularly useful for working with large collections of data, because it allows you to process the data in smaller chunks and reduces the amount of memory that your program uses. It also allows you to write more concise, expressive code, because you can use methods like **Enumerable#map** and **Enumerable#filter** to transform and filter the data without having to create intermediate collections.

For example, if we have a large collection of data and want to process it in smaller chunks, we can use the This code will split the large collection of data into smaller chunks, and will only generate and process each chunk as it is needed. This allows you to work with large collections of data in a more efficient and memory-efficient way.

The Enumerable#lazy method is a powerful tool for working with large collections of data in Ruby, and can help you to write more efficient, expressive code. method to create a lazy enumerable, and then use the **Enumerable#chunk** method to split the data into smaller chunks:

```ruby
# Create a large collection of data
data = (1..1_000_000).to_a

# Create a lazy enumerable from the data
lazy_data = data.lazy

# Use Enumerable#chunk to split the data into smaller chunks
chunks = lazy_data.chunk { |n| n % 1000 }

# Process each chunk of data
chunks.each do |chunk|
  # Output the chunk size
  puts "Chunk size: #{chunk.size}"

  # Process the chunk
  chunk.each do |n|
    # Perform some operation on each item in the chunk
  end
end
```

This code will split the large collection of data into smaller chunks, and will only generate and process each chunk as it is needed. This allows you to work with large collections of data in a more efficient and memory-efficient way.

The **Enumerable#lazy** method is a powerful tool for working with large collections of data in Ruby, and can help you to write more efficient, expressive code.
Laravel vite install bootstrap
Tags: laravel, bootstrap, vite, webdev
Published: 2022-11-30 03:10:46

## Install package

Ensure you have install `vite` and `laravel-vite-plugin`
```node
npm install --save-dev vite laravel-vite-plugin
```
> No need to do this if you make a new app since its included when you create laravel app

and then install bootstrap
```node
npm install --save-dev sass bootstrap @popperjs/core
```

## Configure vite

```
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import path from 'path'

export default defineConfig({
    plugins: [
        laravel([
            'resources/js/app.js',
        ]),
    ],
    resolve: {
        alias: {
            '~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'),
        }
    },
})
```

this allow vite to use bootstrap as an alias so we can use it on js and scss file

## Import package

Create a new file in your resource folder `app.scss` and import it

```scss
// app.scss
// Import Bootstrap css
@import "~bootstrap/scss/bootstrap";
```

and last, import it to the `resources/js/app.js` file or `resources/js/bootstrap.js` file, laravel create those 2 file on the first time

```js
// app.js
// Import our CSS that included bootstrap css
import '../app.scss'

// Import bootstrap JS
import * as bootstrap from 'bootstrap'
```

and then load it in your blade template
`@vite(['resources/js/app.js'])` 


to run it

```node
npm run dev
```

and laravel server

```php
php artisan serve
```

> _if you have error `vite is not recognize as a command or vite not found`_ ensure you already install it, run `npm install` after you create your first laravel app


## Footnote

[Laravel vite docs](https://laravel.com/docs/9.x/vite#installing-vite-and-laravel-plugin)
How to Import Code in DEV from another compiler?
Published: 2022-12-01 10:13:25

Hello there,
I am here with a question. Is there any possibility to Import code from other compiler to DEV. I have develop a tool that is [Pinterest video downloaders](https://pintdown.com/). Now I want to import that code in DEV to make some changes.
If anyone have any solution of it then kindly share it with me.
Thanks in Advance.
Advent of Code 2022 - Day 1
Published: 2022-12-01 10:07:46

---
title: Advent of Code 2022 - Day 1
published: true
description: I'm trying to solve all the Advent of Code puzzles in this video series.
tags:
cover_image: https://i.ytimg.com/vi/yxXL5gP2RpE/maxresdefault.jpg
---

{% youtube yxXL5gP2RpE %}

I'm trying to solve all the Advent of Code puzzles in this video series.