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
extern mod std; | |
enum Drawable { | |
Rectangle(uint, uint, bool), | |
Triangle(uint, bool) | |
} | |
fn draw_triangle(height: uint, empty: bool) { | |
let mut n = 1; | |
info!("Drawing %s triangle", (match empty {true => "empty", false => "full"})); |
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 <iostream> | |
#include "common.hh" | |
#include <algorithm> | |
using slice = std::tuple<numbers::iterator, numbers::iterator>; | |
slice merge(slice x, slice y) { | |
auto left_it = std::get<0>(x), | |
left_size = std::get<1>(x), | |
right_it = std::get<0>(y), |
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
describe Group do | |
describe 'permissions' do | |
describe '#permissions= setter' do | |
let(:opts) { {a: 1} } | |
def g(params = String.new) Group.new(permissions: params).permissions; end | |
it('accepts hash') { g(opts).should eq(opts) } | |
it('accepts JSON') { g(JSON.generate opts).should eq(opts) } | |
it('creates default JSON object') { g.should eq(Hash.new) } | |
end | |
end |
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
add_executable(triangle triangle.cc utility.hh) | |
target_link_libraries(triangle glut GLEW GL) |
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
Glib::ustring NumberConverter::get_result() const { | |
std::stringstream output; | |
long intermediate = 0; | |
switch (_info.from) { | |
case NumberSystem::BASE_2: | |
intermediate = strtol(_input.data(), NULL, 2); | |
break; | |
case NumberSystem::BASE_8: |
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
{ | |
"caret_style": "phase", | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"dictionary": "Packages/Language - English/en_GB.dic", | |
"draw_minimap_border": true, | |
"draw_white_space": "selection", | |
"fade_fold_buttons": false, | |
"fold_buttons": true, | |
"font_face": "Inconsolata", | |
"font_size": 12, |
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
$ python ./tasker.py | |
Available commands: | |
* quit # quits the program | |
* add {name} # adds a task | |
* list # lists current tasks | |
* mark {id} v|o # mark task as done or not | |
******************************* | |
Enter command: add Watch TV |
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
#!/usr/bin/env ruby |
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
#define BLACK 0 | |
#define RED 1 | |
typedef struct tree_el{ | |
int value; | |
struct tree_el *left; | |
struct tree_el *right; | |
int color; | |
} node; |
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
def mergesort(list) | |
return list if list.size <= 1 | |
mid = list.size / 2 | |
merge mergesort(list[0, mid]), mergesort(list[mid, list.size]) | |
end | |
def merge(left, right) | |
sorted = [] | |
until left.empty? or right.empty? | |
if left.first <= right.first |