Skip to content

Instantly share code, notes, and snippets.

// it's 4am somewhere
const moment = require('moment-timezone');
console.log(moment.tz.names().filter(tz => moment.tz(new Date(), tz).hour() === 4));
@davidminor
davidminor / Ungroup.cs
Created March 16, 2011 21:44
Csharp - extension method to spread out or "ungroup" items in a list, according to a supplied function
//http://www.apache.org/licenses/LICENSE-2.0.txt
using System;
using System.Collections.Generic;
using System.Linq;
namespace UngroupExtension
{
public static class UngroupExtension
{
/// <summary>
@davidminor
davidminor / partition-between.clj
Created January 7, 2011 17:14
Clojure - Split a collection into partitions on boundaries specified by supplied function.
(defn partition-between
"Splits coll into a lazy sequence of lists, with partition
boundaries between items where (f item1 item2) is true.
(partition-between = '(1 2 2 3 4 4 4 5)) =>
((1 2) (2 3 4) (4) (4 5))"
[f coll]
(lazy-seq
(when-let [s (seq coll)]
(let [fst (first s)]
(if-let [rest-seq (next s)]