Skip to content

Instantly share code, notes, and snippets.

View ConorOBrien-Foxx's full-sized avatar

Conor O'Brien ConorOBrien-Foxx

View GitHub Profile
@ConorOBrien-Foxx
ConorOBrien-Foxx / ottcb-score.rb
Created March 15, 2017 04:52
Scoring for repeated characters in ruby.
# for http://codegolf.stackexchange.com/q/112827/31957
def repeated_chars(r, can_repeat = false)
-> (s) {
found = {}
repeated = ""
s.chars.each { |c|
found[c] = true if can_repeat
if r === c
if found.has_key? c
repeated += c
@ConorOBrien-Foxx
ConorOBrien-Foxx / obfs.js
Created January 20, 2017 02:12
888 byte Hello World in JavaScript
s=((C=f=>g=>(...a)=>f(g(...a)))&&(H=a=>[...a])&&(v=c=>a=>new(c)(a)))(Set);S=n=>[n,n].map(e=>e.map?e[1]:e).map((e,i)=>e.slice(...s([i,1])));O=J=e=>n=>(e+[])[n];p=h=>!(h&(1<<31)|!h);G=global;h=(f=[][1])=>(c=+[])=>(f+[])[c];E=s=>h(s)(+[]);R=H=>L(H).reverse();s=C((d=".",Z=x=>x))(C(H)(s));D=f=>()=>C(Z)(f);Y=(f,n)=>a=>p(n)?f(Y(f,~-n)(a)):a;L=H;T=(n,i,k=n)=>p(i)?T(n+k,--i,k):S(n)[++[[]][+[]]];f=(M=J)(![]);q=W=>Y(D,W);j=q(2)(E);w=0;X=d=>O=G[(U=x=>x[t](i*z*i+z+z-w++))(16465174322)];r=C((A=h(F=(()=>G)[c=`constructor`]),F)(b=[921631607,1061308,1160108].map(e=>e[t=`${o=(I=++i/0+[])[z=3<<1]}oS${i&&o}r${I[z/=2]}ng`]((2<<2<<2)+~-i)+[(T(A(2<<2),2)+d)[i]||[]],i=0).join``).bind({[z^i]:-192.3,[z-2]:402.4,[o+E(p)+I[z]+E(E)]:E(R)+f(2*2)+T(f(2),2)+J(c)`1`+j`````${j}`+A(2<<2)+E(q)+J(q?c:s)(J(z&~i)|1)+M(!+[])(1<<2>>2<<0)+f(2),[[14,2,3,6].map(A).join``]:640,y:420}))(X)();O[U(22288)](r+E(X)+M(p)(15));
@ConorOBrien-Foxx
ConorOBrien-Foxx / commit.log
Created January 21, 2017 04:19
Thou shalt not forget to commit.
C:\Users\Conor O'Brien\Documents\Programming\stacked\main (master) (stacked@1.0.0)
λ node stacked.js -t
All checks (44) passed successfully
C:\Users\Conor O'Brien\Documents\Programming\stacked\main (master) (stacked@1.0.0)
λ REM goodnight, sweet world
C:\Users\Conor O'Brien\Documents\Programming\stacked\main (master) (stacked@1.0.0)
λ git commit -am "added more tests; fixed some repl bugs"
warning: LF will be replaced by CRLF in src/funcs.js.
@ConorOBrien-Foxx
ConorOBrien-Foxx / increaseUnits.js
Last active January 3, 2017 21:00
c(ode) broken.
// http://seiyria.com/c/
// increaseUnits, original source
(function (){var r=arguments.length<=0||void 0===arguments[0]?1:arguments[0],i=arguments.length<=1||void 0===arguments[1]?"Cheating":arguments[1];e.unit.inc(r*t.all(n),!0,i),"Cheating"===i&&e.achieve("Pumpkin Eater")})
(function(){
// var r=arguments.length<=0||void 0===arguments[0]?1:arguments[0],i=arguments.length<=1||void 0===arguments[1]?"Cheating":arguments[1];
let r = arguments.length <= 0; // if there are no arguments
r = r || undefined === arguments[0]; // or the first is undefined;
if(r){
#from http://stackoverflow.com/a/16363159/4119004
class String
def black; "\e[30m#{self}\e[0m" end
def red; "\e[31m#{self}\e[0m" end
def green; "\e[32m#{self}\e[0m" end
def brown; "\e[33m#{self}\e[0m" end
def blue; "\e[34m#{self}\e[0m" end
def magenta; "\e[35m#{self}\e[0m" end
def cyan; "\e[36m#{self}\e[0m" end
def gray; "\e[37m#{self}\e[0m" end
Object.defineProperty(Array.prototype, "top", {
get: function(){ return this[this.length - 1]; },
set: function(v){ return this[this.length - 1] = v; }
});
class Operator {
constructor(symbol, monad, dyad, precedence, assoc){
this.symbol = symbol;
this.monad = monad;
this.dyad = dyad;
@ConorOBrien-Foxx
ConorOBrien-Foxx / README.md
Created October 19, 2016 02:02
image to text, rough draft.

run as something like

node conv.js <image> | pta.ijs

don't forget to change the dimensions in pta.ijs.

@ConorOBrien-Foxx
ConorOBrien-Foxx / chat.fish
Created October 16, 2016 21:08
Chat command processing in ><>
001. > >~" " >$2p ~ 0&703.
:i:0(?^:a=?^:" "=?^$2p1+
:&:&$g&:&2g:" "=?v=?!v&1+& >
;Dv? =";"~< >1+&~0&:c)?v^ ;< v o<
>&$.; >02g"@"=?!^0["` dnammoc dezingocernu">l?^1v
v o;?< ^ number of commands ;o"`"v!?=" ":g2:<
@type; >i:0(^ v o< v < > o:1+ ^
@bye; "!eyb"oooo; r>l?^;2[0[>i:0(?!^~:a=?~r]r$.;
@what; "this is a command chat interface written in ><>."c2*8.
f =: | , <.@%
q =: 0:`((, ; |) ; [ $: {:@f)@.(*@])
k =: |. @: > @ }: @ q
boxofstr =: [: <;._1 ' ' , ":
pipe =: '|' joinstring boxofstr
roof =: (|:@,.~ ('- ' {~ [: <./\ '|' i. ]))@pipe
boxroof =: roof @ ;
graph =: [: ; [: ,:@{.&.|: boxroof&.>
final =: graph @ k
@ConorOBrien-Foxx
ConorOBrien-Foxx / gen.rb
Created September 5, 2016 19:47
Z80 constant multiplication
def input(prompt = "")
print prompt
$stdin.gets.chomp
end
def log2(n)
Math.log(n, 2)
end
def int_like(n)