Skip to content

Instantly share code, notes, and snippets.

Avatar

Hamed Asghari hasghari

  • G2
  • Salt Lake City, UT
View GitHub Profile
View IdlTask.java
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 Jun 30, 2012
Sample avpr file
View account.json
{
"namespace":"org.sample",
"protocol":"AccountService",
"types":[
{
"name":"Account",
"fields":[
{
"name":"id",
"type":"long"
View account.avdl
@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 Jan 13, 2013
shell script to cleanup local and remote repositories that have been merged
View git_cleanup.sh
#!/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 Apr 19, 2013
underscore.js compatibility with Twitter Typeahead
View underscore_typeahead_mixin.js
_.mixin({
compile: function (str) {
var compiled = _.template(str);
compiled.render = function (context) {
return this(context);
};
return compiled;
}
});
View NERDTree.mkd

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 Dec 25, 2015
angular file upload preview module
View upload_preview.js
(function (module) {
"use strict";
var fileReader = function ($q) {
var onLoad
, onError
, onProgress
, getReader
, readAsDataURL
View save_with_errors.rb
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
View gist:789a569eecf146ea7912608d4c264c08
### 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: