Skip to content

Instantly share code, notes, and snippets.

@buckle2000
buckle2000 / SDL_IME_Text.cpp
Created April 17, 2016 03:39
IME Test of SDL 2.0.4
#include <SDL.h>
#include <string.h>
#include <stdio.h>
#include <string>
char text[1000];
char *composition;
Sint32 cursor;
Sint32 selection_len;
@buckle2000
buckle2000 / Main.hx
Created May 12, 2016 06:49
The minimal project which will cause a bug
package;
import openfl.display.Sprite;
class Main extends Sprite {
public function new () {
super ();
addChild(new NewClass());
}
}
@buckle2000
buckle2000 / require.sublime-snippet
Last active February 6, 2017 07:21
"require" snippet for Moonscripty, for moonscript, and for Sumblime Text 1/2/3
<!-- Edit the tabTrigger field if you wish -->
<snippet>
<content><![CDATA[${1/[-\.]/_/g} = require "${1:}"
${0}]]></content>
<tabTrigger>jf</tabTrigger>
<scope>source.moonscript</scope>
<description>require module</description>
</snippet>
@buckle2000
buckle2000 / rx-subscribe_last.lua
Last active February 6, 2017 18:01
subscribe_last for RxLua.Observable
local rx = require("rx")
rx.Observable.subscribe_last = function(self, callback)
local original_onNext = self.onNext
self.onNext = function(self, ...)
original_onNext(self, ...)
callback(...)
end
return rx.Subscription.create(function()
self.onNext = original_onNext
end)
![love2D version](https://img.shields.io/badge/Love2D-0.10.1-EA316E.svg)
@buckle2000
buckle2000 / array.moon
Created February 28, 2017 08:00
lua helper functions
iter_helper = (t, index) ->
index += 1
if index == t.n
return
return index, t[index]
class Array
new: =>
@n = 0
@buckle2000
buckle2000 / main.moon
Created March 2, 2017 05:33
moonscript/lua ConvChain love2d example
Generator = require "convchain.Generator"
Array2D = require "convchain.Array2D"
img = love.graphics.newImage('seed.png')
imgdata = img\getData!
sample = Array2D(img\getDimensions!)
for x=0,sample.height-1
for y=0,sample.width-1
@buckle2000
buckle2000 / PlayState.hx
Created March 28, 2017 01:53
haxe cannot click transparent sprite only in flash
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.util.FlxColor;
class PlayState extends FlxState
{
var square: FlxSprite;

Prototype

Populate

Polish

#define PIN_RESET 255 //
#define DC_JUMPER 0 // I2C Addres: 0 - 0x3C, 1 - 0x3D
#include <Wire.h> // Include Wire if you're using I2C
#include <SFE_MicroOLED.h> // Include the SFE_MicroOLED library
#include <math.h>
MicroOLED oled(PIN_RESET, DC_JUMPER); // I2C Example
// Global variables to help draw the clock face: