Skip to content

Instantly share code, notes, and snippets.

View ThisGuyCodes's full-sized avatar

Travis Johnson ThisGuyCodes

View GitHub Profile
@ThisGuyCodes
ThisGuyCodes / hello.cpp
Created February 10, 2014 02:48
C++ 'Hello World', with no includes
extern "C" int printf (__const char *__restrict __format, ...);
int main()
{
printf("Hello world!\n");
return 0;
}
@ThisGuyCodes
ThisGuyCodes / cpucache.go
Created February 13, 2014 21:42
set incby = 64, there is no noticeable performance increase
package main
const (
length = 16777216
setto = 'x'
incby = 8
)
func main() {
array := make([]byte, length)
class Array
def each()
counter = 0
while counter < self.len do
yield self[counter]
counter = counter + 1
end
end
image = [
[0,0,0,0],
[0,1,0,0],
[1,0,0,0],
[0,0,0,1]
]
image.each do |row|
puts row
puts "next"
Array.new(rows){Array.new(columns)}
Array.new(rows) do
Array.new(columns)
end
Array.new(rows) do
return Array.new(columns)
end
Array.new(4) do
return 5
end
class Array
def new(size)
counter = 0
#some magic to set the array length to the size variable
while counter < size do
self[counter] = yield
counter = counter + 1
end
end
[0, 0, 0, 0]
[0, 1, 0, 0]
[0, 0, 0, 1]
[0, 0, 0, 0]