Skip to content

Instantly share code, notes, and snippets.

||| fib( 0 ): 0
||| fib( 1 ): 1
||| fib( 2 ): 1
||| fib( 3 ): 2
||| fib( 4 ): 3
||| fib( 5 ): 5
||| fib( 6 ): 8
||| fib( 7 ): 13
||| fib( 8 ): 21
||| fib( 9 ): 34
||| fib( 0 ): 0
||| fib( 1 ): 1
||| fib( 2 ): 1
||| fib( 3 ): 2
||| fib( 4 ): 3
||| fib( 5 ): 5
||| fib( 6 ): 8
||| fib( 7 ): 13
--- fib( 0 ): 0
||| fib( 8 ): 21
kvs := map[string]string{"a": "apple", "b": "banana"}
for k, v := range kvs {
fmt.Printf("%s -> %s\n", k, v) // If I press Enter here
// <-- The cursor jumps here
}
@morganwilde
morganwilde / vimrc
Created March 11, 2014 13:27
vimrc
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup
program Bevarde;
type Taskas3D = record
X:real;
Y:real;
Z:real;
end;
type atkarpa = record
Taskas1: ^Taskas3D;
Taskas2: ^Taskas3D;
#include <stdlib.h>
#include <stdio.h>
struct Point {
int x;
int y;
int z;
};
struct Segment {
#include <limits.h>
#include <stdio.h>
int main(void) {
int value = -1;
printf("UINT_MAX: %u\n", UINT_MAX);
printf("value: %d\n", value);
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
unsigned intToBinaryInt(unsigned k, int *components, int counter) {
// k - current binary component
// components - collection of all the components
// counter - tracks how many components are there
if (k == 0) {
components[counter] = k;
@morganwilde
morganwilde / data.c
Last active August 29, 2015 13:56 — forked from Kablys/data
int data[4], // Allocates an array of type int with 4 elements
i; // Allocates an int
for(i = -8; // Initializes i to -8
i < 10;
i++) // Increments i by 1
printf("%d\n", data[i]);// This will generate an error when i is in [-8, 0)u(3, 9]
// This ^ will iterate over the following values
// -8
int *first, // Allocates a pointer to int
a; // Allocates an int
for ( a = 0; // Initializes a to 0
a < 10;
a++ // Increments a value by 1
) {
first[a] = 5;
}