Skip to content

Instantly share code, notes, and snippets.

# Taken from https://github.com/lsegal/yard-examples/blob/master/override/override.rb
require 'yard'
# Register the tag to be recognized by the parser
YARD::Tags::Library.define_tag 'Overriden Method', :override
# Parse the ruby file
YARD.parse('example_code.rb')
@jiparis
jiparis / build.gradle
Last active March 29, 2019 08:48
Build and include React app in spring boot application (Gradle)
task buildFrontend(type: Exec){
workingDir './frontend'
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine('cmd', '/c', 'npm install')
commandLine('cmd', '/c', 'npm run build')
}
else {
commandLine('sh', '-c', 'npm install')
commandLine('sh', '-c', 'npm run build')
}
@jiparis
jiparis / ruby_interfaces.md
Last active April 26, 2021 16:01
Interfaces and abstract classes in Ruby

Two approaches to interfaces in Ruby:

First aproach

Using inheritance in a cleaner way. It allows abstract classes, but needs a custom inheritance chain and only supports 1 interface.

module Interface
  attr_accessor :is_abstract
  
  def abstract
@jiparis
jiparis / README.md
Created March 19, 2018 12:00 — forked from reu/README.md
Ruby annotations

Imagine this case:

class Account < ActiveRecord::Base
  def transfer(other, quantity)
    tries = 0
    begin
      tries += 1
      transaction do
        self.quantity -= quantity

Keybase proof

I hereby claim:

  • I am jiparis on github.
  • I am jiparis (https://keybase.io/jiparis) on keybase.
  • I have a public key ASCgjOrsJZcStNj4IRl7XNAXIZvSffPZHpkWHtNYOibpPgo

To claim this, I am signing this object:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package com.myapp.anim;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.LinearLayout;
public class CollapseAnimation extends Animation {
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.os.Parcel;
import android.os.Parcelable;