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
| import java.io.File; | |
| import java.io.IOException; | |
| import java.nio.charset.StandardCharsets; | |
| import java.nio.file.Files; | |
| import java.nio.file.Path; | |
| import java.nio.file.Paths; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.Collections; | |
| import java.util.HashMap; |
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
| import com.liveaction.commons.monitor.Timer; | |
| import java.util.ArrayList; | |
| import java.util.HashSet; | |
| import java.util.List; | |
| import java.util.Set; | |
| import java.util.UUID; | |
| class Scratch { | |
| public static void main(String[] args) { |
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
| /** | |
| I created this gist to point out something I consider a bad practice that I've seen in typescript code: | |
| that is overuse of default parameters. The problem with overusing default parameters is that the default behavior | |
| of the function without args is completely implicit and requires the developer to reference the function definition and | |
| memorize whenever they are looking through the code. | |
| In the examples below I took some of our existing code that had such a function retrieveData where its behavior | |
| was hidden behind default parameters. I refactored it by using functions that are named something descriptive that | |
| then call retrieveData with the appropriate parameters. By providing a function with a descriptive name rather than | |
| letting parameter default it is much clearer what the code is doing when you are far away from the retrieveData |
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
| #!/bin/bash | |
| usage="$(basename "$0") [-h] [-i] -- program that uses ffmpeg to convert mac screencapture .mov to a compressed mp4 for sharing | |
| where: | |
| -h show this help text | |
| -i (required) the mov file to convert to mp4 | |
| dependencies: | |
| Requires ffmpeg to be installed and available in the user's PATH. |
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
| function handleDragStart(type, id) { | |
| if (id === SiteTopologyController.SITE_BOUNDING_BOX_ID) { | |
| $('#keylines').css('cursor', 'move'); | |
| scope.isBoundingBoxDragging = true; | |
| return true; | |
| } | |
| else { | |
| return scope.preventMovement(type, id); | |
| } | |
| } |
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
| #!/usr/bin/env python | |
| import sys | |
| import subprocess | |
| def is_valid_ip4(s): | |
| a = s.split('.') | |
| if len(a) != 4: | |
| return False | |
| for x in a: | |
| if not x.isdigit(): |