Skip to content

Instantly share code, notes, and snippets.

View schonstal's full-sized avatar

Josh Schonstal schonstal

View GitHub Profile
function MyClass(config) {
this.initialize(config);
}
MyClass.prototype = {
initialize: function(config) {
//this is the constructor
this._foo = config.foo;
},
herpDerp: function() {
@schonstal
schonstal / gist:1781595
Created February 9, 2012 17:57
Interval -- Magic?
object interval {
val list = collection.mutable.Map[ Class[_], Double ]()
/** Runs a block at a given interval */
def apply(t:Double, executeNow:Boolean=true)( block : =>Unit) {
val klass = (()=>{block}).getClass
if(list.isDefinedAt(klass)) {
val lastTime = list(klass)
if(util.getSeconds - lastTime >= t) {
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
@schonstal
schonstal / gist:1928378
Created February 28, 2012 01:29
pseudocode example for LordNed
package
{
import org.flixel.*;
public class PlayState extends FlxState
{
private var somethingPrivate:Number = 0;
private var player:Player;
override public function create():void {
@schonstal
schonstal / gist:4582735
Created January 21, 2013 00:11
my vimrc
syntax on
filetype on
set tabstop=2
set shiftwidth=2
set expandtab
set smartindent
set number
set guioptions-=T
color brilliance_black
@schonstal
schonstal / gist:4638869
Created January 25, 2013 23:32
hue thing
//In create
palette = new FlxSprite();
palette.loadGraphic(Assets.CMY);
for(var x:int = 0; x < palette.width; x++) {
for(var y:int = 0; y < palette.height; y++) {
var pixel:uint = palette.pixels.getPixel32(x, y);
if(colors.indexOf(pixel) < 0) {
colors.push(palette.pixels.getPixel32(x, y));
}
}
blendedColor =
((((colorAlpha*(newColor&0xff0000) + (256-colorAlpha)*(color&0xff0000)) >> 8) & 0xff0000) |
(((colorAlpha*(newColor&0xff) + (256-colorAlpha)*(color&0xff)) >> 8) & 0xff) |
(((colorAlpha*(newColor&0xff00) + (256-colorAlpha)*(color&0xff00)) >> 8) & 0xff00)) |
0xff000000;
build:
[exec] defaults: Error: unable to open '/usr/local/flex3/bin/../frameworks/flex-config.xml'
[exec] Result: 1
BUILD SUCCESSFUL
Total time: 2 seconds
@schonstal
schonstal / gist:5674536
Created May 29, 2013 23:05
AS3 singleton example
package
{
public class G
{
public var _paused:Boolean;
private static var _instance:G = null;
private static function get instance():G {
if(_instance == null) {
_instance = new G();
#!/bin/bash
SITTING=false
while :; do
if $SITTING
then
terminal-notifier -title "Samuel L. Jackson Says" -message "SIT THE FUCK DOWN"
SITTING=true
else
terminal-notifier -title "Samuel L. Jackson Says" -message "STAND THE FUCK UP"
SITTING=false