Skip to content

Instantly share code, notes, and snippets.

View johnsogg's full-sized avatar

Gabe Johnson johnsogg

View GitHub Profile
@johnsogg
johnsogg / gist:4422506
Last active December 10, 2015 10:39
Hello planet Earth, this is a test
public static void main(String[] args) {
System.out.println("This is almost the simplest Java program possible.");
}
#import <iostreams>
int main()
cout << "Hi";
}
$ cd ~/Projects/retrograde/master_grade_script/
~/Projects/retrograde/master_grade_script $ ./grade.py -h
usage: grade.py [-h]
instructor_dir assignment student_id student_file
[student_file ...]
positional arguments:
instructor_dir top level directory for instructor assignments
assignment specify the homework assignment (e.g. 'linked list')
student_id specify the student (e.g. '978675643')
@johnsogg
johnsogg / gist:4638191
Created January 25, 2013 21:49
seg fault is somewhere
void remove(node** parent, int offset) {
node* cursor = *parent;
if (cursor->next==NULL || offset > size(*parent)) {
return;
} else if (offset==0) {
cursor=cursor->next;
} else {
for (int i=1;i<offset;i++) {
cursor=cursor->next;
}
print "Hello World"
@johnsogg
johnsogg / test.py
Last active December 11, 2015 23:59
def test_remove(self):
self.tree = self.build_big_tree()
expected = [ 6, 8, 9, 10, 11, 12, 14, 20, 27, 28 ]
# ensure it starts out as intended. this should always pass
actual = []
self.private_inorder_fetch(self.tree.root_node, actual)
self.assertEqual(expected, actual, "Initial tree was malformed. Our fault, not yours")
# remove the top node, 20
#include <iostream>
using namespace std;
struct node {
int value;
node* next;
};
int add_to_all(node** top_ref, int num) {
// find the largest product of 4 of the numbers in any direction (up,
// down, left, right, diagonal) in my output I get the file location
// "0xbfca024c" repeated
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
@johnsogg
johnsogg / FontPathHelper.cs
Last active October 8, 2019 01:49
Demonstration of GetPathForGlyph and CGPath in Xamarin.iOS for getting a vector representation of character glyphs. Includes quadratic and cubic Bezier functions.
using System;
using System.Collections.Generic;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreText;
namespace Mystuff
{
public class FontPathHelper
{

Keybase proof

I hereby claim:

  • I am johnsogg on github.
  • I am johnsogg (https://keybase.io/johnsogg) on keybase.
  • I have a public key whose fingerprint is E5A0 CBC0 B7D7 C8AC DC64 B709 22E7 7A60 E4AF F491

To claim this, I am signing this object: