Skip to content

Instantly share code, notes, and snippets.


Ernesto García gnapse

View GitHub Profile
gnapse /
Last active Aug 29, 2015
Some features implemented with and without reactive programming
Kefir.Observable.prototype.withIndex = (mapType, fn) ->
index = 0
this[mapType]((value) -> fn(value, index++))
ApiController = Ember.Controller.extend
# With reactive programming
# (also needs the function withIndex in the top of this file)
postNotifications: (startCallback) ->
gnapse / Testing.scala
Last active Mar 7, 2017
Testing if it's possible to have Scala class parameters not becoming instance attributes
View Testing.scala
// Regarding these discussions about Scala class constructor parameters:
// Class parameter `fake` is not prefixed by either `val` or `var`
class Testing(fake: Boolean) {
val buffer = if (fake) null else new StringBuilder()
def output(str: Any): Unit = {
// The class parameter `fake` is accessible beyond the construction phase

Keybase proof

I hereby claim:

  • I am gnapse on github.
  • I am gnapse ( on keybase.
  • I have a public key ASCLxlhSQ3ZoFyZr7YlHbhD-jI9RoitJ0FdwytXR6XEF7Qo

To claim this, I am signing this object:


Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

gnapse / visual-surround.vim
Created Aug 19, 2013
Convenient key-bindings for an easier use of the vim-surround plugin. See for details.
View visual-surround.vim
" Surround text currently selected in visual mode
" (The surrounded text is kept selected after being surround)
vmap <leader>" S"lvi"
vmap <leader>' S'lvi'
vmap <leader>` S`lvi`
vmap <leader>( S)lvi(
vmap <leader>{ S}lvi{
vmap <leader>[ S]lvi[
vmap <leader>< S>lvi<
You can’t perform that action at this time.