Skip to content

Instantly share code, notes, and snippets.

#include <engine/sprite.hh>
#include <string>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
namespace mnts
{
Sprite::Sprite(SDL_Surface * gameScreen, std::string texture, int x, int y)
{
@beakr
beakr / repl.c
Last active August 29, 2015 13:56
Simple Ruby REPL with mruby. Made as a test for the mruby C API.
#include <stdio.h>
#include <mruby.h>
#include <mruby/compile.h>
int main(int argc, char ** argv)
{
mrb_state * mrb = mrb_open();
char code[250];
while (1) {
printf("[max:250]> ");
/Users/chris/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.4.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
the more detail of.
@beakr
beakr / install-gtk.sh
Created February 3, 2014 00:17
Install GTK+ 3.0 on Mac OS X.
# Use Python 2.7
$ pyenv global system
# Use Homebrew to install
$ brew install gtk+3
@beakr
beakr / arg_example.rb
Created January 12, 2014 22:31
Rake task arguments example with evil hacks
# From: http://itshouldbeuseful.wordpress.com/2011/11/07/passing-parameters-to-a-rake-task/
def task_arg(var)
task var.to_sym {}
end
task :hello do
name = ARGV.last # Get last arg (ARGV.first is task name)
abort "I can't say hello to nobody. :(" if name.empty?
puts "Hello #{name}!"
def f;m=%,He#{:ll}o #{?w+?o}rld\n,;s=(:a1[1].to_i)-0.5;;m.split(//)
.each{|c|print((->{%?#{c}?}.call));sleep(s)};
puts((%Q%#{?t+?h}%+%?a?+%{t w#{"aa"[1]}s boring...}));;end;f;
/Users/chris/.rvm/gems/ruby-2.0.0-p247/gems/kgio-2.8.1/lib/kgio_ext.bundle: [BUG] Segmentation fault
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.4.0]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
the more detail of.
@beakr
beakr / iecomment.html
Created January 4, 2014 23:25
UPDATE YOUR BROWSER LIEK NAOW.
<!--[if lte IE 7]>
<p>
Oops! Looks like your browser is <strong>outdated</strong>. This means that
you may not be able to view certain sites correctly. Please download a later
version of the software you use to browse the internet for the best experience.
</p>
<![endif]-->
@beakr
beakr / Gemfile
Created January 4, 2014 21:59
Simple Ruby code for parsing markdown in a directory (Github flavoured Markdown, that is).
# Run 'bundle' in the command line afterward
source 'https://rubygems.org'
gem 'guard'
gem 'guard-rake'
gem 'rake'
gem 'rainbow'
gem 'github-markdown'
@beakr
beakr / button.qss
Created December 23, 2013 05:00
Fairly nice Qt buttons that can be easily made great with a few tweaks of the hex codes.
QPushButton {
color: white;
background-color: QLinearGradient(x1: 0, y1: 0,
x2: 0, y2: 0.15,
stop: 0 #31363a,
stop: 0.5 #2a2e32);
border: 1px solid #2a2e32;
border-radius: 10px;
}