Skip to content

Instantly share code, notes, and snippets.

View mk0x9's full-sized avatar

Mikhail Kuryshev mk0x9

  • Berlin, Germany
  • 04:59 (UTC +02:00)
View GitHub Profile
We couldn’t find that file to show.
@mk0x9
mk0x9 / gist:752705
Created December 23, 2010 07:36
sdl.go
package sdl
func c_SDL_Init(flags uint32) int __asm__ ("SDL_Init");
func c_SDL_SetVideoMode(width, height, bpp int, flags uint32) *Surface __asm__("SDL_SetVideoMode");
func c_SDL_Delay(ms uint32) __asm__ ("SDL_Delay");
func c_SDL_Quit() __asm__ ("SDL_Quit");
func c_SDL_UpperBlit(src *Surface, srcrect *Rect, dst *Surface, dstrect *Rect) int __asm__ ("SDL_UpperBlit");
func c_SDL_Flip(screen *Surface) int __asm__ ("SDL_Flip");
func c_SDL_FreeSurface(surface *Surface) __asm__ ("SDL_FreeSurface");
func c_SDL_LoadBMP_RW(src *RWops, freesrc int) *Surface __asm__ ("SDL_LoadBMP_RW");
@mk0x9
mk0x9 / sdl_constants.c
Created December 23, 2010 17:16
sdl.go
package sdl
// #include "SDL/SDL.h"
// #include "SDL/SDL_image.h"
import "C"
import (
"unsafe"
)
package main
import (
"fmt"
)
type foo struct {
b int
c int
}
cirno@perfect-math-class ~/sources/gollvm $ make
CGOPKGPATH= cgo -- `llvm-config --cflags` core.go executionengine.go target.go transforms_scalar.go transforms_ipo.go analysis.go bitwriter.go
error: 'LLVMInitializeCppBackendTargetInfo' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: 'LLVMInitializeARMTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeCellSPUTarget' undeclared (first use in this function)
error: 'LLVMInitializePowerPCTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeCBackendTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeAlphaTargetInfo' undeclared (first use in this function)
error: 'LLVMInitializeMBlazeTargetInfo' undeclared (first use in this function)
package main
import "fmt"
func main() {
var x byte
for {
fmt.Scan("%c", &x)
fmt.Printf("\nGot: '%c'\n", x)
}
(defun ac-go-candidates ()
(ac-go-autocomplete))
(defvar ac-source-go
'((candidates . ac-go-candidates)
(prefix . "\\.\\(.*\\)")
(requires . 0)))
(defun ac-go-get-candidate-strings (tmpbuf)
(split-string (with-current-buffer tmpbuf (buffer-string)) "\n"))
@mk0x9
mk0x9 / direction.hs
Created October 23, 2011 13:37
Direction
entity2order :: Ant -> Point -> [Order]
entity2order a food = let xant = snd.point $ a
yant = fst.point $ a
xfood = snd food
yfood = fst food
in case compare xant xfood of
GT -> map (Order a) (directionClockWise West)
LT -> map (Order a) (directionClockWise East)
EQ -> case compare yant yfood of
GT -> map (Order a) (directionClockWise North)
@mk0x9
mk0x9 / annoying_keys_unity_2d.diff
Created November 9, 2011 18:44
Disable annoying hotkeys in unity 2d
diff -Naur unity-2d.orig//unity-2d-4.12.0/launcher/app/launcherview.cpp unity-2d/unity-2d-4.12.0/launcher/app/launcherview.cpp
--- unity-2d.orig//unity-2d-4.12.0/launcher/app/launcherview.cpp 2011-09-29 18:12:44.000000000 +0400
+++ unity-2d/unity-2d-4.12.0/launcher/app/launcherview.cpp 2011-11-09 23:00:07.008801565 +0400
@@ -164,7 +164,7 @@
/* If the key is released, and was not being held, it means that the user just
performed a "tap". Unless we're told to ignore that tap, that is. */
if (!m_superKeyHeld && !m_superPressIgnored) {
- Q_EMIT superKeyTapped();
+ //Q_EMIT superKeyTapped();
}
def index
@rooms = Room.includes :user
result = []
@rooms.each do |room|
el1 = {}
el2 = {}
Room.column_names.each { |col| el1[col] = room.send col }
User.column_names.each { |col| el2[col] = room.user.send col }
result << el1.merge(user: el2)