Skip to content

Instantly share code, notes, and snippets.

@beakr
beakr / gist:5841049
Created June 22, 2013 14:21
Soap comment headers.
//
// Soap is a mostly-open-source, minimal operating system written in C and YASM
// assembly. Soap's source code way be used as you wish under the following terms
// (it's a form of the BSD license):
//
// Copyright (c) 2013, Christopher Clarke
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
@beakr
beakr / sdl.cpp
Last active December 16, 2015 22:29
Got SDL C++ lib to work with Xcode 4. Make sure you have SDL.framework, Cocoa.framework, and OpenGL.framework.
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#define WIDTH 640
#define HEIGHT 480
#define WINDOW_TITLE "Hello, SDL!"
SDL_Surface *screen;
@beakr
beakr / gist:5428226
Created April 21, 2013 02:29
Schnops programming language syntax.
# Welcome to Schnops! This is a comment.
# Comments are ignored when you run the program.
#-
If you have a lot of cool comments you can put
them all in a multiline commment. Multiline comments
can space multiple lines and have to be opened and closed
with '#-' and '-#'.
-#
@beakr
beakr / include_method.rb
Created April 20, 2013 17:45
Find out if a module includes a method.
module C
def bananas
puts :Bananas!
end
end
def include_method?(method, mod)
if mod.methods.include? method
puts "Module #{mod} has method #{method}"
true
@beakr
beakr / crazy_module_stuff.rb
Last active December 16, 2015 11:19
Defining modules without module declarations.
module A; end
A::B = Module.new do
define_method :hello do
puts :hello
end
end
A::B::hello #=> hello
$ bundle binstubs rspec-core
$ bin/rspec . # Prefix with the time command and compare with bundle exec, or standard rspec command!
@beakr
beakr / dabblet.css
Created April 14, 2013 23:12
Untitled
body {
padding: 70px;
}
.field {
padding: 5px 5px 5px 12px;
width: 225px;
font-size: 16px;
border: 1px solid #c2c2c2;
@beakr
beakr / application_helper.rb
Created April 14, 2013 03:02
Neat little widget for Devise greeting the user in a random language.
# coding: utf-8
# Make sure you declare the use of utf-8
# so you can use characters from other
# languages.
module ApplicationHelper
def greeting
# Add more here
greetings = ['Hello', 'Greetings', 'Hi', 'Kon\'nichiwa', 'Bonjour',
'Cześć', 'Olá', 'Hallo', 'Hei', 'Hallå']
@beakr
beakr / floss-spec.md
Created April 13, 2013 02:44
Floss specification.

Floss Specification

Floss is a minimal, object-oriented language for creating software in relatively little time, with relatively little code. First, we'll go through some main ideas behind Floss:

  • Floss is somewhat statically typed, but is a dynamic language
  • Floss is small and embeddable
  • Floss has a fast, lightweight, register-based VM
  • Floss is fully implemented in C, with a lexer/parser in Flex and Bison
  • Floss is free, and open source, and always will be for as long as it's maintained
  • Floss is a mix of many other great languages:
@beakr
beakr / verbose_app.ru
Last active December 15, 2015 21:39
Verbose sinatra app (yes, it works).
require (%q%sinatra%);
class Application < Sinatra::Base;
get(%%/%) {
%q|#{:"Hello, world!"}|}; ##
end;
run(
Application);;