I like to call foldr
as "fold from the right", while foldl
is "fold from the
left".
This file contains 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
// **************************************************************************************************************************** | |
// Abstract: | |
// This script is just a quick hack to export the owners and members of a team as a CSV file without administrator permissions. | |
// | |
// Usage: | |
// 1. Open your team | |
// 2. Select "Manage team" from its menu | |
// 3. Select the "Members" tab | |
// 4. Expand the "Owners" and "Members and guests" sections | |
// 5. Make sure to scroll down to the end of the owners and members lists to include all of them in your export (As the members are loaded on demand) |
This file contains 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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.List; | |
import com.google.common.collect.ComparisonChain; | |
import org.apache.commons.beanutils.BeanComparator; | |
import org.apache.commons.collections.comparators.ComparatorChain; | |
import org.apache.commons.lang3.builder.CompareToBuilder; |
This file contains 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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
You have a 16x16 grid of which the 4 centermost cells are always 100 degrees and the cornermost cells are always 0 degrees. All other cells start at 50 degrees.
For example, a 6x6 grid would look like this:
| 0 | 50 | 50 | 50 | 50 | 0 |
| 50 | 50 | 50 | 50 | 50 | 50 |
| 50 | 50 | 100 | 100 | 50 | 50 |
This file contains 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
(defn ema [f values] | |
(reductions (fn [running v] | |
(let [one-minus-F (- 1 f)] ;naming intermediate results can help with the readability of non-associative operators. | |
(+ (* f v) | |
(* one-minus-F running)))) | |
values)) |