Skip to content

Instantly share code, notes, and snippets.

@beakr
beakr / arm-compile.sh
Created August 22, 2013 01:50
Compile ARM assembly on Mac.
# This command takes iPhone's LLVM GCC and compiles ARMV6 assembly. E.g. my_assembly.s
$ /Developer/Platforms/iPhoneOS.platform/usr/bin/llvm-gcc-4.2 -arch armv6 -c ${YOUR_FILE}.s
-- Wat.
-- No clue if this works, just writing Haskell.
f x y = x + y -- Random function
let resultOfF = f 2 2 -- 4
let someList = [1, 2, 3]
let someListWithOtherThing = resultOfF:someList
addLists x y = x ++ y
@beakr
beakr / parens.js
Created July 2, 2013 18:21
Use as many as you want.
print((((((((2 + 2))))))));
console.log(((8 + 2)));
@beakr
beakr / gist:5863114
Created June 25, 2013 22:38
The first hello world ever from the original document on the B language.
main() {
printf("hello, world");
}
@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!