Skip to content

Instantly share code, notes, and snippets.

View jfernandez's full-sized avatar
🦀
Rust and eBPF

Jose Fernandez jfernandez

🦀
Rust and eBPF
View GitHub Profile
@jfernandez
jfernandez / gist:61675081ca8fec3eb171
Last active September 7, 2015 04:16
Finagle: serve Thrift over HTTP
object Main extends App {
val filter = new FooFilter
val fooService = new FooService.FinagledService(new FooServiceImpl, new TCompactProtocol.Factory()) // Use the protocol your client uses
val httpService: Service[HttpRequest, HttpResponse] = filter andThen fooService
val server = Http.serve(":10051", httpService)
Await.ready(server)
}
function saveObject(request) {
// Return 200 and close the connection right away.
// The client doesn't need to wait for the DB.
request.reply({}).code(200);
db.ModelFoo.create(request.params).success(function(record) {
// This event gets fired some milliseconds later.
// You can chain other business logic here or log success.
});
@jfernandez
jfernandez / gist:5320608
Last active December 15, 2015 20:41
Javascript constructors and the prototype object
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.speak = function () {
return "Hello, my name is " + this.name;
}
Person.prototype.canVote = function() {
@jfernandez
jfernandez / gist:2626144
Created May 7, 2012 05:50
Anytime you save a file send a POST request to a URL with the filename
autocmd BufWritePost * silent! exec "!curl -d 'filename=" . expand('<afile>') . "' http://domain.com &>/dev/null &"
" This single line of text is a trigger that tells Vim to run $ source ~/.vimrc when the file is saved
autocmd! BufWritePost .vimrc source $MYVIMRC
/usr/lib/ruby/1.8/rubygems/format.rb:38:in `from_file_by_path': Cannot load gem at [/var/lib/gems/1.8/cache/daemons-1.1.4.gem] in /home/hudson/workspace/storefront_ds_task (Gem::Exception)
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:100:in `spec_from_gem'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:77:in `fetch'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:50:in `run'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
from /var/lib/gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
#!/bin/bash
############################################################################
# Script to open a directory in TextMate excluding certain directories that
# tend to slow down the Find in Project... function.
#
# Place in an executable loctation with a name of your choosing.
# I use `ate' and have it in ~/Local/bin (which has been added to $PATH)
############################################################################
@jfernandez
jfernandez / gist:1051472
Created June 28, 2011 16:00
Commits in branch2 missing from branch1 by author
git log <branch1>..<branch2> --author=<pattern>
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require 'resque/server'
run Rack::URLMap.new \
"/" => Mailto::Application,
"/resque" => Resque::Server.new
<iframe src="http://www.facebook.com/plugins/like.php?href={{ current_page_url | html_escape }}&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>