Skip to content

Instantly share code, notes, and snippets.

View mhoc's full-sized avatar
🐢

Mike Hockerman mhoc

🐢
View GitHub Profile
0eNq1Xe1u2zgQfBf9dg7iN5lXOQSFk6ipcI5tyPbhiiLvfnJ8PetUrTPLufwq2jQ7XIq73BmuqB/N4+bU7Yd+e2zufzT90257aO5//9Ec+pftenP+t+P3fdfcN/2xe21WzXb9ev7b1/XheHcc1tvDfjcc7x67zbF5WzX99rn7q7k3b6sPLTx26xFs8kv27WHVdNtjf+y7yxje//L9y/b0+tgNo9Wb6KtmvzuMvzvaHCFHe3cm2d/Cqvne3Lvgfwsj0nM/dE+X/2LPQ5wBWAIgjAALJp3aZKsbs1cDGB1A0ALErAOIaoCiA0hqgKgDyGqApAMoaoCgAzCtGsErEdTRG50SQR2+UZkfjDqaozLYjDqcozJfGHU8h/JRkjORsImNWh3DQZmFjDqIgzKIjTqKgzIPWXUUB2WesOooDso8YdVRHJR5wqqjOGjrCHUUB2WesPooVuYJq45pfyPi/BKCOqZ9USLMYvqw3/TH4/iTRduTHPdfy6vma785/9p9cxrH2J9e76zLo5Hd6bg/Hb+M1fNuGHHHn2+6r+c6+NeRqGPf38gucanQVMe+j0oEdez7oERQx773SgRHlPhRKPE9YTMJNpldWhons0tL40xElkhIDLtMIEQIoRB5CPLBtwQC5INnuHFefraeocNFsOmINSiN0xM2pXEGYtVl6IlFYk0UCIGJTQwhEz5gs1Tq1+CZGS0929ASNo1g09SvQXGclrApjfMaf4fT4+G4fv/9RXLzj6GxNmy2Xf/y7XF3Gs6ynHHtw5JlX7/a3kf74VoIREy+z/HHCERMgj4QNS/oQyZWtxVWDROFbtlmbInVLYwzMlEojdMST8whTyw6AsFCCExsYj4wsYn5EIk16IVnmwibghYWM7EGpXEWwqYwzkTUpDEgTywZAgHi98kSqw7zwREImA8Ee4wC00uBsCkwvUSwR3GcibApjZOoSSPE5hLBFyPE5nJLrDrIh2wIBMwHgj1GgellQr2JAtPLBHsUx0moN+I4CT02QmwuE3wxQmw

Keybase proof

I hereby claim:

  • I am mhoc on github.
  • I am mhoc (https://keybase.io/mhoc) on keybase.
  • I have a public key ASCK_anh5N4ABkQSA5fNNFJaFpNmI-rYAvjQm99WDpL2MAo

To claim this, I am signing this object:

@mhoc
mhoc / full.py
Last active November 6, 2015 20:23
class Shape:
def __init__(self):
object.__init__(self)
class Rectangle(Shape):
def __init__(self, width=7, height=9):
self._width = width
self._height = height
self._area = width * height
@mhoc
mhoc / a.py
Created November 6, 2015 20:07
def __setattr_(self, attr, val):
if attr == "area":
return
self[attr] = val
@mhoc
mhoc / app.js
Last active August 23, 2022 22:42
SIGAPP Meeting 11
var app = angular.module('chatApp', ['firebase'])
app.controller('ChatCtrl', ['$scope', '$firebase', function($scope, $firebase) {
var msgRef = new Firebase("https://anvil-demo.firebaseio.com/messages")
var sync = $firebase(msgRef)
$scope.messages = sync.$asArray()
$scope.addMessage = function(text) {
@mhoc
mhoc / index.html
Last active October 20, 2015 23:42
SIGAPP Meeting 10
<html>
<head>
<title>Awesome Chat App!</title>
<script src="https://cdn.firebase.com/js/client/2.1.2/firebase.js"></script>
<script data-require="jquery@2.1.4" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<RelativeLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
def sort_tup(tu):
''' Sorting function for the (index, score) tuple '''
index, score = tu
return score
def find_best_value(capacity, scores, tuples):
''' Find the highest valued item from scores which still fits in our capacity '''
for i in xrange(len(scores)):
index, score = scores[i]
weight, value = tuples[index]
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" >
<item name="android:actionBarStyle">@style/ActionBar</item>
</style>
<style name="ActionBar" parent="android:style/Widget.Holo.ActionBar" >
<item name="android:titleTextStyle">@style/ActionBarTitleText</item>
<item name="android:background">@color/primaryAppColor</item>
</style>
@mhoc
mhoc / is_prime.py
Last active October 5, 2015 20:37
Python script for determining if a number is prime or not.
def isPrime(n):
if n <= 1:
return False
if n == 2:
return True
if n % 2 == 0:
return False
for item in range(3,int(n/2)+1,2):
if n % item == 0:
return False