Skip to content

Instantly share code, notes, and snippets.

View zmack's full-sized avatar
👓
Bungles

Andrei Bocan zmack

👓
Bungles
View GitHub Profile
function RacerGoToDefinition()
let current_line = line(".")
let current_column = col(".")
let current_file = expand("%")
let command = g:racer_cmd." find-definition ".current_line." ".current_column." ".current_file
let definition = system(command)
let matches = split(split(definition, "\n")[0], ",")
if split(matches[0], " ")[0] != "MATCH"
### Keybase proof
I hereby claim:
* I am zmack on github.
* I am zmack (https://keybase.io/zmack) on keybase.
* I have a public key whose fingerprint is AC46 AEDB 6BFE 3F87 8065 5A3A CEC1 A6BC 8709 DF7D
To claim this, I am signing this object:
@zmack
zmack / test.rs
Last active August 29, 2015 14:11
impl Operation for Bar {
fn add(&self, other: int) {
}
}
impl OtherOperation for Bar {
fn zero(&self) -> uint {
0
}
#[deriving(Show,Clone)]
enum DiskStruct {
File(String),
Dir(String)
}
impl DiskStruct {
fn new(path: &str) -> DiskStruct {
match path.slice_from(path.len()-1) {
"/" => DiskStruct::Dir(path.to_string()),
@zmack
zmack / server.rs
Created October 1, 2014 08:37
Slow server, for some reason
use std::io::fs;
use std::io::fs::PathExtensions;
use std::io::net::pipe::UnixListener;
use std::io::{Acceptor,Listener};
use std::string::String;
fn main() {
let socket = Path::new("server.sock");
let mut buffer = String::with_capacity(1024);
Index: net/instaweb/rewriter/rewrite_context.cc
===================================================================
--- net/instaweb/rewriter/rewrite_context.cc (revision 4146)
+++ net/instaweb/rewriter/rewrite_context.cc (working copy)
@@ -962,7 +962,7 @@
handler_->Message(
kInfo, "Deadline exceeded for rewrite of resource %s with %s.",
input->url().c_str(), rewrite_context_->id());
- FetchFallbackDoneImpl(input->contents(), input->response_headers());
+ FetchFallbackDoneImpl(input->contents(), input->response_headers(), true);
(print [1 2 3 4 5])
(seq {:a 1 :b 2})
((fn foo [x] (when (> x 0) (conj (foo (dec x)) x))) 5)
(seq (reverse (range 1 6)))
(-> (range 5) reverse filter `#(% > 1))
(-> [2 5 4 1 3 6] reverse rest sort last)
@zmack
zmack / Hiya
Created June 10, 2013 15:03
Sql
mysql> create table mars( id int unsigned, bar enum('foo','bar','baz'))
mysql> insert into mars values (1,'foo'), (2, 'bar'), (3, 'baz');
mysql> select * from mars;
+------+------+
| id | bar |
+------+------+
| 1 | foo |
| 2 | bar |
true
true
true
true
true
user system total real
Foo 0.990000 0.000000 0.990000 ( 0.989358)
Bar 0.720000 0.000000 0.720000 ( 0.713166)
Baz 0.320000 0.000000 0.320000 ( 0.323896)
Fle 0.330000 0.000000 0.330000 ( 0.326319)
#!/usr/bin/env ruby
require 'net/http'
def get_server(site)
Net::HTTP.start(site, 80) do |http|
response = http.head('/')
response['server']
end
rescue Exception => e