Skip to content

Instantly share code, notes, and snippets.

View ypereirareis's full-sized avatar
:octocat:
Hello ! Have you seen Batman ?

Yannick Pereira-Reis ypereirareis

:octocat:
Hello ! Have you seen Batman ?
View GitHub Profile
@reegnz
reegnz / README.md
Last active October 22, 2024 13:55
The Terraform group_by you've been missing

The Terraform group_by you've been missing

I'm playing around a lot nowadays with Terraform 0.13 and I found a really interesting feature and that's the ... symbol (also called an ellipsis) to be used with for expressions.

The operator can be used for group_by operations.

Example

We have a list of entries. The list contains employee/manager/project triplets.

// $ yarn add request request-promise
// $ node count userA userB
const request = require('request-promise')
const get = resource => request({
url: /^https/.test(resource) ? resource : `https://api.github.com/${resource}`,
headers: {
'User-Agent': 'GitHub Contrib Counter',
'Authorization': 'token YOUR_PERSONAL_ACCESS_TOKEN'
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active August 27, 2024 05:35
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,