Skip to content

Instantly share code, notes, and snippets.

terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
required_version = ">= 0.14.9"
}
const NodeCache = require("node-cache");
const cache = new NodeCache();
const Coda = require('coda-js').default;
const bearer = process.env.CODA_API_TOKEN;
const coda = new Coda(bearer);
const docId = "XXXXX";
var router = require('express').Router();
# cat data.txt | python jira-sprint-percentage-complete.py
import sys, re, csv
minutes_in_hour = 60
minutes_in_day = 24 * minutes_in_hour
minutes_in_week = 7 * minutes_in_day
def pull_time(s, unit, minutes):
; Challenges from https://www.4clojure.com/
; 120
(fn [col]
(count
(filter
(fn [n] (< n (reduce +
(->> n
str
(require '[clojure.java.io :as io]
'[clojure.string :as string])
(use '[clojure.pprint :only (pp pprint)])
(defn if-nil [orig value]
"Returns orig or value if orig is nil. Prob something like this already in contrib"
(if (nil? orig) value orig))
(require '[clojure.java.io :as io]
'[clojure.string :as string])
(defn file-to-vecs [filename]
(with-open [rd (io/reader (io/file filename))]
(->> (line-seq rd)
(map string/trim-newline)
(map #(.split ^String % "\t"))
@abuggia
abuggia / solution.js
Created October 23, 2012 21:35
Setup for coding challenge
var fs = require("fs");
var process = function(productsData, salesData) {
console.log(salesData.split('\n').length + ' lines in the sales file')
console.log(productsData.split('\n')[0])
}
fs.readFile("products.tab", 'utf-8', function (error, productsData) {
_.mixin
# Make an associative array from two arrays
associate: (keys, vals) ->
_.reduce(_.zip(keys, vals), (acc, pair) ->
acc[pair[0]] = pair[1]
acc
, {})
def with_file(file_name)
file = File.new(file_name, "r")
data = {}
while (line = file.gets)
key, value = line.chomp.split "\t"
yield(data, key, value)
end
file.close
data
end
def with_file(file_name)
file = File.new(file_name, "r")
data = {}
while (line = file.gets)
key, value = line.chomp.split "\t"
yield(data, key, value)
end
file.close
data
end