I want a cool and beautiful timer for my own website. So, i do this one with canvas. :)
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Starting to play around with html5 canvas more I came across this loader by Jack Rugile and proceeded to try and make something similar. End result seems okay. Any tips would be welcome :)!
A Pen by Lennart Hase on CodePen.
This file contains hidden or 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 echo | |
{ | |
void exec()(const float* a, int size) | |
{ | |
for(int n = 0; n < size; ++n) | |
printf("%15d%15.5f\n", n, a[n]); | |
} | |
void exec()(const float* a, const float* b, int size) | |
{ |
This file contains hidden or 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
template <typename type_t> | |
struct pod | |
{ | |
type_t exec()() | |
{ | |
type_t type; | |
memset(&type, 0, sizeof(type_t)); | |
return type; | |
} |
This file contains hidden or 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
inline char* base64_encode(const unsigned char* data, int input_length, int* output_length) | |
{ | |
static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', | |
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', | |
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', | |
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', | |
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', | |
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', | |
'w', 'x', 'y', 'z', '0', '1', '2', '3', | |
'4', '5', '6', '7', '8', '9', '+', '/' |
This file contains hidden or 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
inline void echo_bin_octal(const char*, const char* path, void* app_, node<message*>** errors) | |
{ | |
int size; | |
unsigned char* buffer = load_binary(path, &size, errors); | |
if(*errors) | |
{ | |
push_message(errors, 0, 0, 1, __FILE__, __FUNCTION__, __LINE__, "bad path: %s", path); | |
return; | |
} |
This file contains hidden or 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
inline void echo_csv(const char*, const char* path, void* app_, node<message*>** errors) | |
{ | |
/* | |
const char* line = | |
"AAC,20120426\r\n" | |
"BBB,20120425\r\n"; | |
*/ | |
int linesn; | |
char** lines = load_file_lines(path, linesn); | |
for(int n = 0; n < linesn; ++n) |
This file contains hidden or 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
inline rectangle* uniform_fitted_rectangle::get(int cols, int rows, int width, int height, int margin) | |
{ | |
if(width < 0 || height < 0) | |
return 0; | |
int size = cols * rows; | |
int n = 0; | |
int y = 0; | |
int iheight = height + margin; | |
int rwidth = width + margin; |
OlderNewer