Skip to content

Instantly share code, notes, and snippets.

Avatar

Ernesto García gnapse

View GitHub Profile
@gnapse
gnapse / post-notifications.coffee
Last active Aug 29, 2015
Some features implemented with and without reactive programming
View post-notifications.coffee
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
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:
// http://stackoverflow.com/questions/15639078/scala-class-constructor-parameters
// http://stackoverflow.com/questions/1889454/in-scala-how-do-you-define-a-local-parameter-in-the-primary-constructor-of-a-cl
// 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
View keybase.md

Keybase proof

I hereby claim:

  • I am gnapse on github.
  • I am gnapse (https://keybase.io/gnapse) on keybase.
  • I have a public key ASCLxlhSQ3ZoFyZr7YlHbhD-jI9RoitJ0FdwytXR6XEF7Qo

To claim this, I am signing this object:

View pr.md

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 = git@github.com:joyent/node.git

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
gnapse / visual-surround.vim
Created Aug 19, 2013
Convenient key-bindings for an easier use of the vim-surround plugin. See http://gnapse.github.io/2013/08/12/easier-use-of-the-vim-surround-plugin/ 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.