Skip to content

Instantly share code, notes, and snippets.

View muraiki's full-sized avatar

Erik Ferguson muraiki

View GitHub Profile
@muraiki
muraiki / 28.apl
Created July 28, 2017 19:02
Generate series of 28 numbers in ascending order that total close to 1500 (APL)
⍝ https://ngn.github.io/apl/web/index.html#code=s%u21902%D71+%u237314%0Ax%u2190%28s%2C-s%29+%284%D7%u237328%29%0A%u2395%20%u2190x%5B%u234Bx%5D%0A%u2395%20%u2190+/x
s←2×1+⍳14
x←(s,-s)+(4×⍳28)
⎕ ←x[⍋x]
⎕ ←+/x
@muraiki
muraiki / 28.ijs
Created July 28, 2017 19:03
Generate series of 28 numbers in ascending order that total close to 1500 (J)
((,-)(2*>:&i.14))+(4*i.28)
@muraiki
muraiki / pb.html
Last active January 22, 2018 16:50
Salesforce Process Builder: Generate formula code for matching multiple values
<form>
<label for="fieldName">Field name (include object):</label>
<input id="fieldName" name="fieldName" type="text" size="100" onkeydown="if (event.keyCode == 13) false">
</form>
<p>
<input type="checkbox" id="isPicklist" name="isPicklist" value="picklist">
<label for="isPicklist">Picklist?</label>
<input type="checkbox" id="isNot" name="isNot" value="not">
<label for="isNot">NOT?</label>
@muraiki
muraiki / reduce_in_r.R
Created March 27, 2018 00:38
Calculating a rolling sum in R using the Reduce function
# Rolling sum using the Reduce function
EV <- c(1,.9,.8,.001,.001,.001,.001)
# Proportion of variance explained by each principle component.
prop_var <- EV / sum(EV)
# 0.3698224852 0.3328402367 0.2958579882
# 0.0003698225 0.0003698225 0.0003698225
# 0.0003698225