Skip to content

Instantly share code, notes, and snippets.

View hasghari's full-sized avatar

Hamed Asghari hasghari

  • G2
  • Salt Lake City, UT
View GitHub Profile
import org.apache.avro.Protocol;
import org.apache.avro.compiler.idl.Idl;
import org.apache.avro.compiler.idl.ParseException;
import org.apache.avro.compiler.specific.ProtocolTask;
import org.apache.avro.compiler.specific.SpecificCompiler;
import org.apache.tools.ant.BuildException;
import java.io.File;
import java.io.IOException;
@hasghari
hasghari / account.json
Created June 30, 2012 20:14
Sample avpr file
{
"namespace":"org.sample",
"protocol":"AccountService",
"types":[
{
"name":"Account",
"fields":[
{
"name":"id",
"type":"long"
@hasghari
hasghari / account.avdl
Created June 30, 2012 20:22
Avro avdl file
@namespace("org.sample")
protocol AccountService {
record Account {
long id;
string name;
union {null, string} description = null;
}
Account addAccount(string name, union {null, string} description);
@hasghari
hasghari / git_cleanup.sh
Created January 13, 2013 16:58
shell script to cleanup local and remote repositories that have been merged
#!/bin/sh
# This has to be run from master
git checkout master
# Update our list of remotes
git fetch
# Delete stale remote-tracking branches
git remote prune origin
@hasghari
hasghari / underscore_typeahead_mixin.js
Created April 19, 2013 17:00
underscore.js compatibility with Twitter Typeahead
_.mixin({
compile: function (str) {
var compiled = _.template(str);
compiled.render = function (context) {
return this(context);
};
return compiled;
}
});

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@hasghari
hasghari / upload_preview.js
Last active December 25, 2015 21:58
angular file upload preview module
(function (module) {
"use strict";
var fileReader = function ($q) {
var onLoad
, onError
, onProgress
, getReader
, readAsDataURL
module SaveWithErrors
def self.prepended(base)
base.serialize :record_errors, Hash
base.after_validation :assign_errors
end
def save(*args)
super(*args) || save_anyway
end
### Keybase proof
I hereby claim:
* I am hasghari on github.
* I am hasghari (https://keybase.io/hasghari) on keybase.
* I have a public key whose fingerprint is 8985 D427 9191 A4B2 765A A677 AC4A 6555 2229 25BF
To claim this, I am signing this object: