Skip to content

Instantly share code, notes, and snippets.

View TheThirdOne's full-sized avatar

Benjamin Landers TheThirdOne

  • Los Angeles, California
View GitHub Profile
class Test {
public static void main(String[] args){
int[][] test = new int[34][];
test[0] = new int[3];
test[0][1] = 1;
test[1] = new int[3];
test[2] = new int[3];
test[3] = new int[3];
System.out.println(log(test));
}
function compute1(x){
if(x==0)return x;
if(x > 0)return 2*x-1;
if(x < 0)return -2*x;
}
function compute2(x,y){
let xbar = compute1(x);
let ybar = compute1(y);
let z = xbar+ybar;
macro_rules! string_equals {
($t:ty,$x:expr,$y:expr) => {
{
assert_eq!(format!("{}",$x),$y);
let result = <$t>::parse(&mut $y.chars().peekable());
match result {
Ok(z) => assert_eq!(z,$x),
Err(e) => {print!("Failed to parse \"{}\" as {:?} with error message \"{}\"",$y,$x,e); assert!(false)},
}
}
impl Parsable for Move {
fn parse(iter:&mut Peekable<Chars>) -> Result<Self,ParseError> {
Ok(match iter.next() {
Some('M') => {
let origin = Num::parse(iter)?;
let ship = Ship::parse(iter)?;
let destination = if iter.peek().map_or(false,|c|char::is_digit(*c,10)) {
Ok(Num::parse(iter)?)
}else{
Err(Ship::parse(iter)?)

GSOC 2018 - Benjamin Landers

The first subpart of my GSOC 2018 project was working on feature to rotate models based by selecting a face. After working on it for while, it, was merged into master. Unfortunately, a few bugs crept through, but were quickly caught by the community and then fixed.

After that I attempted and failed to solve some minor bugs (one of which I encountered earlier in the summer).

Then I moved on to the next large subpart of the summer, working on porting the 3d views from Perl to C++. While I made good progress on the 3D plater, there are still a few things that are a few i

sub escaped_split {
my ($line) = @_;
# Free up three characters for temporary replacement
$line =~ s/%/%%/g;
$line =~ s/#/##/g;
$line =~ s/\?/\?\?/g;
# replace escaped \'s
$line =~ s/\\\\/%#\?/g;
function Bus(){
var valueQueue = [];
var promiseQueue = [];
return {
send:function(val){
if(promiseQueue.length != 0){
var toResolve = promiseQueue.shift();
toResolve(val);
} else {
valueQueue.push(val);
@TheThirdOne
TheThirdOne / anotherlemma.txt
Last active February 16, 2018 01:16
Fuck this proof
"1. ((~C->((~C->~C)->~C))->((~C->(~C->~C))->(~C->~C))) Axiom (A2)
2. (~C->((~C->~C)->~C)) Axiom (A1)
3. ((~C->(~C->~C))->(~C->~C)) Modus Ponens: 2, 1
4. (~C->(~C->~C)) Axiom (A1)
5. (~C->~C) Modus Ponens: 4, 3
6. (~C->(C->~C))
@TheThirdOne
TheThirdOne / exists.js
Created December 28, 2017 02:10
Higher order function practice
function Exists(fn, range){
return function(item){
for(var i of range){
if(fn(i)(item))return true;
}
return false;
};
}
function Some(fn,ranges){
function h(arr, N){
let sum = 0;
// the special bounds checks don't include edges
for(let i = 2; i <= N-1; i++){
for(let k = 1; k < i; k++){
// if there is not a neighboring zero
if(![l(i-1,k),l(i+1,k),l(i-1,k-1),l(i+1,k+1),l(i,k-1),l(i,k+1)].map(j=>arr[j]).reduce((acc,z)=>acc||z===0,false)){
sum += arr[l(i,k)];
}
}