Skip to content

Instantly share code, notes, and snippets.

View hamaluik's full-sized avatar
👋
I may be slow to respond.

Kenton Hamaluik hamaluik

👋
I may be slow to respond.
View GitHub Profile
@hamaluik
hamaluik / markdown_thirdparty.py
Created September 25, 2014 23:58
A Pelican plugin to enable third party Markdown extensions
# -*- coding: utf-8 -*-
"""
Markdown Third Party
============================
This plugin allows you to use various third-party
Markdown extensions to make writing posts in Markdown
easier and better.
"""
@hamaluik
hamaluik / !DevConsole.hx
Created April 9, 2015 06:46
Showing how to use macros to get a list of all methods with a specific metadata at runtime. Very kludgey, my first attempt, but it works.
package dc;
import dc.DevConsoleInjector;
import haxe.macro.Context;
import haxe.macro.Expr;
typedef ConsoleCommand = {
var className:String;
var methodName:String;
}
@hamaluik
hamaluik / StaticTilemap.hx
Last active August 29, 2015 14:19
StaticTilemap.hx
import luxe.importers.tiled.TiledMap;
import luxe.options.TilemapOptions;
import luxe.tilemaps.Ortho;
import luxe.tilemaps.Tilemap;
import phoenix.geometry.Geometry;
import phoenix.geometry.QuadPackGeometry;
import phoenix.Rectangle;
import phoenix.Texture;
import phoenix.Vector;
@hamaluik
hamaluik / ScreenSpaceZoom.hx
Last active August 29, 2015 14:19
This will keep sprites in the same position on the screen no matter the zoom. Demo: http://luxe.blazingmammothgames.com/screenspacezoom
// demoed at: http://luxe.blazingmammothgames.com/screenspacezoom
import luxe.Color;
import luxe.Input;
import luxe.Sprite;
import luxe.Vector;
import phoenix.Batcher;
import luxe.Camera;
class Main extends luxe.Game {
var worldSprite:Sprite;
@hamaluik
hamaluik / .gitconfig
Created October 8, 2015 17:42
GIt config aliases
[alias]
history = log --pretty=format:'%C(cyan)%h%Cred%d %Creset%s%Cgreen [%cn] %C(blue)(%cr)' --decorate
@hamaluik
hamaluik / perCpuUsage.py
Created August 16, 2012 18:05
Reporting Per-CPU Processor Usage With Python
#!/usr/bin/env python
import psutil
while True:
print psutil.cpu_percent(interval=1, percpu=True)
@hamaluik
hamaluik / gist:3372222
Created August 16, 2012 18:09
Getting HTML Data From a Webpage Using Python
#!/usr/bin/env python
import urllib2
# get the html of a url
def GetHTML(url):
# open it up
f = urllib2.urlopen(url)
str = f.read()
return str
@hamaluik
hamaluik / gist:3372229
Created August 16, 2012 18:09
Sorting objects in Java
class Derp {
// hold the rank of each derp here
int rank;
}
// now, we must make a comparator class which knows how to sort our Derp class:
class DerpComp implements Comparator<Derp> {
public int compare(Derp a, Derp b) {
// return -1 if a < b
if(a.rank < b.rank)
@hamaluik
hamaluik / gist:3372233
Created August 16, 2012 18:10
Spanning Multiple Rows or Columns in Tables in LaTeX
\usepackage{multirow}
...
\begin{table}[H]
\begin{center}
\caption{Example}
\label{tab:example}
\begin{tabular}{lcc}
Column A & \multicolumn{2}{c}{Columns B and C} \\
@hamaluik
hamaluik / gist:3372235
Created August 16, 2012 18:10
Adding Slanted Fractions in LaTeX
\usepackage{xfrac}
...
\begin{itemize}
\item 1$\sfrac{1}{4}$ cups of sugar
\item $\sfrac{1}{2}$ cup of butter
\end{itemize}