This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'matrix' | |
Constraints = Matrix[ | |
[ 1.0, -1.0, 0.0, 1.0, -1.0], | |
[ 1.0, 1.0, -1.0, 0.0, 0.0], | |
[ 1.0, -1.0, 0.0, -1.0, 1.0], | |
] | |
puts "Constraints: #{Constraints}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in the .h file | |
@interface Foo : Bar { | |
@public | |
int _ivar1; | |
@protected | |
int _ivar2; | |
int _property2; | |
@private | |
int _ivar3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KillableInterface : abstract class { | |
dyingNoise : abstract func -> String {} | |
} | |
KillableReference : cover { | |
obj : Pointer | |
impl : KillableInterfaceClass | |
} | |
KillableDog : abstract class extends KillableInterface { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct timeval start_time, end_time; | |
gettimeofday(&start_time, NULL); | |
for(int i=0; i<count; i++) | |
currDemo->updateFunc(i); | |
gettimeofday(&end_time, NULL); | |
long millisecs = (end_time.tv_sec - start_time.tv_sec)*1000; | |
millisecs += (end_time.tv_usec - start_time.tv_usec)/1000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void func2(int a, int b, int c){ | |
printf("%d %d %d\n", a, b, c); | |
} | |
void func1(int c){ | |
func2(1,2,c); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void func2(int a, int b, int c, int d, int e){ | |
printf("%d %d %d %d %d\n", a, b, c, d, e); | |
} | |
void func1(int d){ | |
func2(1,2,3,4,d); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdarg.h> | |
// NOTE: double precision floats count as two arguments | |
// givenArgc - count of arguments generated function should accept | |
// largeStruct - true if the function returns a struct larger than 4bytes | |
// func - function to wrap | |
// partialArgc - count of arguments passed by the trampoline to func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdarg.h> | |
// NOTE: double precision floats count as two arguments | |
// givenArgc - count of arguments generated function should accept | |
// largeStruct - true if the function returns a struct larger than 4bytes | |
// func - function to wrap | |
// partialArgc - count of arguments passed by the trampoline to func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iterating a singly linked list ring | |
// operations might include splicing or deleting elements | |
node *elt = first, *next; | |
do { | |
next = elt->next; | |
// do stuff here including modify elt->next | |
} while((elt = next) != first); | |
// is there a less verbose way? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ************** oggsteamer.h | |
#define NUM_BUFFERS 4 | |
#define BUFFER_SIZE 65536 | |
#define BUFFER_MSECS 10 | |
typedef struct { | |
char *data; | |
int data_length; | |
int seek_offset; |
OlderNewer