Skip to content

Instantly share code, notes, and snippets.

@tpisto
tpisto / main.rs
Last active April 18, 2022 14:32
OrcV2CBindingsBasicUsage.c in Rust llvm-sys
// https://github.com/tpisto
// Nearly 1:1 translation of /llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c
// to Rust. In order to keep it even more 1:1 readable, I kept variable names as they are in the C -file.
extern crate llvm_sys as llvm;
use libc::*;
use llvm::core::{
LLVMAddFunction, LLVMAppendBasicBlock, LLVMBuildAdd, LLVMBuildRet, LLVMCreateBuilder,
LLVMFunctionType, LLVMGetGlobalPassRegistry, LLVMGetParam, LLVMInt32Type,
LLVMModuleCreateWithNameInContext, LLVMPositionBuilderAtEnd, LLVMShutdown,
@tpisto
tpisto / KeyboardHandler.js
Created June 23, 2016 13:39 — forked from dbasedow/KeyboardHandler.js
Keyboard spacing solution for react-native based on the stackoverflow answer http://stackoverflow.com/a/33585501/1783214
// Based on dbasedow/KeyboardHandler.js
/**
* Based on http://stackoverflow.com/a/33585501/1783214
*
* Handle resizing enclosed View and scrolling to input
* Usage:
* <KeyboardHandler ref='kh' offset={50} >
* <View>
* ...
* <TextInput ref='username'