Skip to content

Instantly share code, notes, and snippets.

Avatar

Rafael Munitić rubber-duck

View GitHub Profile
View gist:2350d2361a2afd4408ab
import bmesh
import bpy
bm = bmesh.new()
bm.from_mesh(bpy.context.object.data)
bm.faces.ensure_lookup_table()
bm.verts.ensure_lookup_table()
new_face = bm.faces[0].copy()
View gist:5932806
rust: task failed at 'index out of bounds: the len is 6 but the index is 7', /home/wiseen/SDK/rust/src/libstd/str.rs:1561
/home/wiseen/Work/srsc/libsyntax/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f97a39a414b]
/home/wiseen/Work/srsc/libsyntax/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(+0x2b899)[0x7f97a39b5899]
/home/wiseen/Work/srsc/libsyntax/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/librustrt.so(upcall_fail+0x1a8)[0x7f97a39a61f8]
/home/wiseen/Work/srsc/libsyntax/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.7-pre.so(_ZN3sys13begin_unwind_16_89e154cd09156716_07preE+0x2e4)[0x7f97a3ceab24]
/home/wiseen/Work/srsc/libsyntax/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd-6c65cf4b443341b1-0.7-pre.so(+0x6c88e)[0x7f97a3c4688e]
/home/wiseen/Work/srsc/libsyntax/../../../../../usr/local/lib/rustc/x86_64-unknown-linux-g
View gist:5888555
use std::vec;
use std::str;
use std::char;
use std::iterator;
use std::num::strconv;
use token;
struct Scanner<'self> {
source: &'self str,
next: uint,
View gist:5844737
struct Foo<'self>
{
foo: &'self fn()
}
impl<'self> Foo<'self> {
fn foo(&self) {
println("Method foo");
}
}
View gist:5843227
#[deriving(Clone)]
struct Foo<'self>
{
foo: &'self str
}
fn main() {
}
View gist:5834958
struct Foo {
bar: ~[int]
}
fn main() {
let mut foo = Foo { bar: ~[0i] };
foo.bar = append_one(foo.bar, 1);
}
View gist:5725536
pub use self::_vec2::vec2;
pub use self::_vec3::vec3;
pub use self::_vec4::vec4;
macro_rules! impl_vec_dot(
($x: ident, $y: ident, $z: ident, $w: ident) => ( x.$x * y.$x + x.$y * y.$y + x.$z * y.$z + x.$w * y.$w );
($x: ident, $y: ident, $z: ident) => ( x.$x * y.$x + x.$y * y.$y + x.$z * y.$z );
($x: ident, $y: ident) => ( x.$x * y.$x + x.$y * y.$y );
)
View gist:5723283
macro_rules! define_vec (
($vect: ident, $vecmod: ident, $compt: ty, $($components: ident)+) => (
mod $vecmod {
#[deriving(ToStr)]
pub struct $vect { $($components : $compt),+ }
impl $vect
{
#[inline(always)]
pub fn new($($components: $compt),+) -> $vect {
View gist:5722958
#[deriving(ToStr)]
struct Vec3f {
x: f32,
y: f32,
z: f32
}
macro_rules! impl_vec_op(
($tr: ident, $op: ident, $vt: ident, $($members: ident)+) => (
impl $tr<$vt, $vt> for $vt {
View gist:5717733
src/functions.rs:1557:109: 1557:113 error: unresolved import. maybe a missing `extern mod libc`?
src/functions.rs:1557 fn glDrawElementsInstancedBaseInstance(mode: ::GLenum, count: ::GLsizei, gltype: ::GLenum, indices: *::libc::c_void, instancecount: ::GLsizei, baseinstance: ::GLuint);
^~~~
src/functions.rs:1557:109: 1557:123 error: use of undeclared module `::libc`
src/functions.rs:1557 fn glDrawElementsInstancedBaseInstance(mode: ::GLenum, count: ::GLsizei, gltype: ::GLenum, indices: *::libc::c_void, instancecount: ::GLsizei, baseinstance: ::GLuint);
^~~~~~~~~~~~~~
src/functions.rs:1557:109: 1557:123 error: use of undeclared type name `libc::c_void`
src/functions.rs:1557 fn glDrawElementsInstancedBaseInstance(mode: ::GLenum, c
You can’t perform that action at this time.