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
L = [.075, .225, .375, .525, .675] | |
d = [.1, .14, .13, .03, 0] | |
V = [.88, .75, .35, .07, 0] | |
i = 0 | |
partials = [] | |
def discharge(L: list[float], d: list[float], V: list[float], i: int, partials: list[float]): | |
if len(L) != len(d) != len(V): |
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
awk -F/, 'BEGIN{print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<string-array name=\"food\">"}{print " <item>" $0 "</item>"}END{print "</string-array>\n"}' food.txt > food-array.xml |
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
class BooleanSerializerSpecs : Spek() { init { | |
val gson = GsonBuilder() | |
.registerTypeAdapter(Boolean::class.java, BooleanSerializer()) | |
.create() | |
given("a valid json string with a boolean field as Y and one as N") { | |
val json = | |
""" | |
{ |
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.util.ArrayDeque; | |
import java.util.Deque; | |
public class StackQueue<T> { | |
private Deque<T> in; | |
private Deque<T> out; | |
public StackQueue() { | |
this.in = new ArrayDeque<>(); |
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
package me.ramseyboy.function | |
import java.util.* | |
/** | |
* A container object which may or may not contain a non-null value. If a value is defined, `isdefined()` will return `true` and `get()` will return the value. | |
* | |
* Additional methods that depend on the presence or absence of a contained value are provided, | |
* such as [orElse()][.orElse] (return a default value if value not defined) |
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 collapse_pwd { | |
echo $(pwd | sed -e "s,^$HOME,~,") | |
} | |
function prompt_char { | |
git branch >/dev/null 2>/dev/null && echo '±' && return | |
hg root >/dev/null 2>/dev/null && echo '☿' && return | |
echo '○' | |
} |
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
/* | |
P is the duration designator (historically called "period") placed at the start of the duration representation. | |
Y is the year designator that follows the value for the number of years. | |
M is the month designator that follows the value for the number of months. | |
W is the week designator that follows the value for the number of weeks. | |
D is the day designator that follows the value for the number of days. | |
T is the time designator that precedes the time components of the representation. | |
H is the hour designator that follows the value for the number of hours. | |
M is the minute designator that follows the value for the number of minutes. | |
S is the second designator that follows the value for the number of seconds. |