Skip to content

Instantly share code, notes, and snippets.

View bugaevc's full-sized avatar

Sergey Bugaev bugaevc

View GitHub Profile
fn print_sum(v: Vec<i32>) {
println!("{}", v[0] + v[1]);
// v is dropped and deallocated here
}
fn main() {
let mut v = Vec::new(); // creating the resource
for i in 1..1000 {
v.push(i);
}
@bugaevc
bugaevc / highlight.js
Last active December 2, 2015 18:53 — forked from anonymous/highlight.js
var highlight = "NAME GOES HERE";
(function() {
"use strict";
var rows = document.getElementsByClassName("st_team");
var found;
for(var i = 1; i < rows.length - 3; i++)
from tornado.httpclient import AsyncHTTPClient
import tornado.gen
import tornado.ioloop
import timeit
@tornado.gen.coroutine
def make_request(index):
client = AsyncHTTPClient()
print(index, 'started')
response = yield client.fetch('http://google.com', raise_error=False)
@bugaevc
bugaevc / prefix_notation.c
Created March 1, 2015 14:25
Homework task #2
#include <stdio.h>
#include <stdlib.h>
void report_error(char *s)
{
printf("syntax error: expected %s\n", s);
}
@bugaevc
bugaevc / area_calculation.c
Last active August 29, 2015 14:15
Homework task
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define F(x) (f(x)-g(x))
#define F1(x) (f1(x)-g1(x))
typedef double (*func)(double);
double root(func f, func g, func f1, func g1, double a, double b, double eps1)