This file contains hidden or 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
| terraform { | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| version = "~> 3.27" | |
| } | |
| } | |
| required_version = ">= 0.14.9" | |
| } |
This file contains hidden or 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 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(); |
This file contains hidden or 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
| # 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): |
This file contains hidden or 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
| ; Challenges from https://www.4clojure.com/ | |
| ; 120 | |
| (fn [col] | |
| (count | |
| (filter | |
| (fn [n] (< n (reduce + | |
| (->> n | |
| str |
This file contains hidden or 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 '[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)) |
This file contains hidden or 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 '[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")) |
This file contains hidden or 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
| 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) { |
This file contains hidden or 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
| _.mixin | |
| # Make an associative array from two arrays | |
| associate: (keys, vals) -> | |
| _.reduce(_.zip(keys, vals), (acc, pair) -> | |
| acc[pair[0]] = pair[1] | |
| acc | |
| , {}) |
This file contains hidden or 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 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 |
This file contains hidden or 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 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 |
NewerOlder