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
// 1. Define an interface for the optional args to your constructor. | |
interface PersonArgs { | |
nickname?: string; | |
age?: number; | |
} | |
class Person { | |
// 2. Add the args as the last parameter of the constructor, with a default value of {}. |
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
#!/bin/bash | |
# | |
# Repeatedly performs rsyncs with the given arguments until | |
# the output seems to indicate there are no more changes, or | |
# a maximum number of iterations is reached, whichever comes first. | |
# | |
# Invoke the same way you would rsync. Verbose output is forced, since | |
# that's how it detects if any changes were transferred..so specifying | |
# -v is redundant. | |
# |
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
#!/bin/sh | |
curl -Ssf "$1" > /dev/null | |
if [[ $? -ne 0 ]]; then | |
echo "Error: Non-200 returned for url $1" | |
exit 1 | |
fi |
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 javax.imageio.ImageIO; | |
import javax.imageio.ImageReader; | |
import javax.imageio.stream.FileImageInputStream; | |
import javax.imageio.stream.ImageInputStream; | |
import java.awt.*; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.Iterator; | |
/** |
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
'If G and H are defined for the given row, add the difference to K and clear them | |
Private Sub Update_Total(ByVal Row As Integer) | |
Dim punchStart, punchEnd, timeWorked As Integer | |
punchStart = Range("G" & Row).Value | |
punchEnd = Range("H" & Row).Value | |
timeWorked = punchEnd - punchStart | |
If (punchStart > 0 And punchEnd > 0 And timeWorked > 0) Then | |
Range("K" & Row).Value = Range("K" & Row) + timeWorked | |
Range("G" & Row).Value = "" | |
Range("H" & Row).Value = "" |
Solr has built-in CSV export and import facilities, which can be used to copy data from one core to another.
You can use the following process to select documents from one core and move them to another, using only the Solr Admin UI, Chrome, and curl.
- Use the Solr Admin UI's Query screen to formulate a query for the subset of documents you want to dump.
- Run the query and click on the link that gives you the raw query results.
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
#!/usr/bin/env node | |
"use strict"; | |
// what does this function return? | |
function a() | |
{ | |
return | |
{ | |
i: 1 |
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
#!/bin/bash | |
# | |
# Dumps a subset of one Solr core and loads it into another one. | |
# | |
# WARNING: THIS DUMP AND LOAD IS LOSSY -- DO NOT USE IT FOR BACKUPS! | |
# In particular, multi-valued fields won't import in the target exactly as they were in the source. | |
# | |
# Before running, change the variables below as needed for your task. | |
# |
I hereby claim:
- I am cwilper on github.
- I am cwilper (https://keybase.io/cwilper) on keybase.
- I have a public key whose fingerprint is 9316 C0C1 B5A6 2552 5568 335D 1173 084A BA6C 1222
To claim this, I am signing this object: